123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using UnityEngine;
- using System;
- using System.Collections.Generic;
- using Sfs2X.Core;
- using Sfs2X.Entities;
- using Sfs2X.Requests;
- using Sfs2X.Entities.Data;
- public class EventDispatcher
- {
- public SFSEventManager SFSEventManager;
- public EventDispatcher(SFSEventManager eventManager)
- {
- SFSEventManager = eventManager;
- SFSEventManager.GardenSmartFox.SmartFox.AddEventListener(SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse);
- }
- public void OnExtensionResponse(BaseEvent baseEvent)
- {
- string cmd = baseEvent.Params["cmd"].ToString();
- if (cmd == PlazaRoomRep.JoinRoomError.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnJoinPlazaRoomError(baseEvent);
- }
- else if (cmd == PlazaRoomRep.JoinRoomSucceed.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnJoinPlazaRoomSucceed(baseEvent);
- }
- else if (cmd == PlazaRoomRep.CreateRoomError.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnCreateRoomError(baseEvent);
- }
- else if (cmd == PlazaRoomRep.CreateRoomSucceed.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnCreateRoomSucceed(baseEvent);
- }
- else if (cmd == PlazaRoomRep.ReceiveInfo.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnReceiveInfo(baseEvent);
- }
- else if (cmd == PlazaRoomRep.ActivateDefaultChest.GetHashString())
- {
- }
- else if (cmd == PlazaRoomRep.CreateChestError.GetHashString())
- {
- }
- else if (cmd == PlazaRoomRep.CreateChestSucceed.GetHashString())
- {
- }
- else if (cmd == PlazaRoomRep.ReceiveNewChest.GetHashString())
- {
- }
- else if (cmd == PlazaRoomRep.ReceiveChestRefund.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnReceiveChestRefund(baseEvent);
- }
- else if (cmd == PlazaRoomRep.ReceiveChestAward.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnReceiveChestAward(baseEvent);
- }
- else if (cmd == PlazaRoomRep.ReceiveAllChestData.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnReceiveAllChestData(baseEvent);
- }
- else if (cmd == PlazaRoomRep.ReceiveRoomData.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnReceiveRoomData(baseEvent);
- }
- else if (cmd == PlazaRoomRep.ReceiveCustomRoomData.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnReceiveCustomRoomData(baseEvent);
- }
- else if (cmd == PlazaRoomRep.ReceiveRoomStatus.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnReceiveRoomStatus(baseEvent);
- }
- else if (cmd == PlazaRoomRep.OtherEnterRoom.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnOtherEnterRoom(baseEvent);
- }
- else if (cmd == PlazaRoomRep.OtherExitRoom.GetHashString())
- {
- SFSEventManager.PlazaRoomEvent.OnOtherExitRoom(baseEvent);
- }
- else
- {
- throw new Exception();
- }
- }
- }
|