Inheritance: MonoBehaviour
Exemple #1
0
    private static void OnCreateAssetCallBack(string t)
    {
        List <string> paths = new List <string>();

        paths.Add(t);
        UpdateAsset(paths);
        GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnCreateAsset, t);
    }
    static void ReceviceStartSyncMsg(InputNetworkMessageEvent e)
    {
        Protocol.StartSyncMsg msg = new Protocol.StartSyncMsg();
        msg.frame        = (int)e.Data["frame"];
        msg.intervalTime = (int)e.Data["intervaltime"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
Exemple #3
0
    private static void OnDeleteAssetCallBack(AssetDeleteResult t, string t1, RemoveAssetOptions t2)
    {
        List <string> paths = new List <string>();

        paths.Add(t1);
        UpdateAsset(paths);
        GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnDeleteAsset, t, t1, t2);
    }
    protected override void OnStart()
    {
        base.OnStart();

        m_moveDistance = (4.47f - 4.14f) / m_dropDownTime;

        GlobalEvent.AddEvent("WeightDropDown", HandleWeightDropDown);
    }
Exemple #5
0
    /// <summary>
    /// 释放堆内存
    /// </summary>
    public static void FreeHeapMemory()
    {
        GlobalEvent.DispatchEvent(MemoryEvent.FreeHeapMemory);

        DataManager.CleanCache();
        ConfigManager.CleanCache();
        RecordManager.CleanCache();
    }
    protected override void OnStart()
    {
        base.OnStart();

        m_animator = GetComponent <Animator>();

        GlobalEvent.AddEvent("Cellar_Open", HandleCellarOpen);
    }
    public static PacketWriter Clear(GlobalEvent globalEvent)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.GLOBAL_PORTAL);

        pWriter.Write(GlobalPortalPacketMode.Clear);
        pWriter.WriteInt(globalEvent.Id);
        return(pWriter);
    }
 public override void Init()
 {
     GlobalEvent.AddTypeEvent <SyncEntityMsg>(ReceviceSyncEntity);
     GlobalEvent.AddTypeEvent <DestroyEntityMsg>(ReceviceDestroyEntityMsg);
     GlobalEvent.AddTypeEvent <ChangeSingletonComponentMsg>(ReceviceChangeSingletonCompMsg);
     GlobalEvent.AddTypeEvent <StartSyncMsg>(ReceviceStartSyncMsg);
     GlobalEvent.AddTypeEvent <T>(ReceviceCommandMsg);
 }
Exemple #9
0
    static void ReceviceDestroyEntityMsg(InputNetworkMessageEvent e)
    {
        Protocol.DestroyEntityMsg msg = new Protocol.DestroyEntityMsg();
        msg.frame = (int)e.Data["frame"];
        msg.id    = (int)e.Data["id"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
 public void AddEventListener(Enum l_Event)
 {
     if (!m_EventNames.Contains(l_Event))
     {
         m_EventNames.Add(l_Event);
         GlobalEvent.AddEvent(l_Event, Refresh);
     }
 }
Exemple #11
0
 public override void Init()
 {
     base.Init();
     if (SDKManager.IncludeThePayPlatform(StoreName.HuaWei))
     {
         GlobalEvent.AddTypeEvent <PrePay2Client>(OnPrePay);
     }
 }
 private static void Init()
 {
     GlobalEvent.AddTypeEvent <UserLogin2Client>(OnUserLoginEvent);
     GlobalEvent.AddTypeEvent <UserLogout2Client>(OnUserLogoutEvent);
     ResendMessageManager.Init();
     AutoReconnectController.EndReconnect += OnEndReconnect;
     AutoReconnectController.Init();
 }
Exemple #13
0
 internal void InvokeGlobalEvent(Event current, GlobalEvent e)
 {
     if (e == null)
     {
         return;
     }
     e.Invoke(current);
 }
    static void RecevicePursueMsg(InputNetworkMessageEvent e)
    {
        Protocol.PursueMsg msg = new Protocol.PursueMsg();
        msg.frame        = (int)e.Data["frame"];
        msg.advanceCount = (int)e.Data["advancecount"];

        GlobalEvent.DispatchTypeEvent(msg);
    }
        public void SingleComponentValueRollbackTest()
        {
            ResourcesConfigManager.Initialize();
            WorldManager.IntervalTime = 100;

            LockStepEntityTestWorld world = (LockStepEntityTestWorld)WorldManager.CreateWorld <LockStepEntityTestWorld>();

            world.IsClient = true;
            world.IsStart  = true;
            world.IsLocal  = true;

            ConnectStatusComponent csc = world.GetSingletonComp <ConnectStatusComponent>();

            csc.confirmFrame = 0; //从目标帧之后开始计算

            SelfComponent sc = new SelfComponent();

            /*EntityBase c1 =*/ world.CreateEntityImmediately("1", sc);

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            TestSingleComponent tc = world.GetSingletonComp <TestSingleComponent>();

            Assert.AreEqual(0, tc.testValue);

            TestCommandComponent cmd = new TestCommandComponent();

            cmd.frame  = 1;
            cmd.id     = 1;
            cmd.isFire = true;
            GlobalEvent.DispatchTypeEvent(cmd);

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            tc = world.GetSingletonComp <TestSingleComponent>();
            Assert.AreEqual(1, tc.testValue);

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            tc = world.GetSingletonComp <TestSingleComponent>();
            Assert.AreEqual(1, tc.testValue);

            cmd        = new TestCommandComponent();
            cmd.frame  = 2;
            cmd.id     = 1;
            cmd.isFire = true;
            GlobalEvent.DispatchTypeEvent(cmd);

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            tc = world.GetSingletonComp <TestSingleComponent>();
            Assert.AreEqual(2, tc.testValue);
        }
Exemple #16
0
    public void EnqueueRandom(ElementType eleType)
    {
        GlobalEvent evt = eleEventControllerList[(int)eleType].GetRandom();

        if (evt != null)
        {
            eventQueue.Enqueue(evt);
        }
    }
Exemple #17
0
    void initialiseEvents()
    {
        GlobalEvent globalEvent = new GlobalEvent();

        globalEvent.name = "Hell";
        globalEvent.description = "Spawn a lot of lava";
        globalEvent.time = 10000;
        globalEvents.Add (globalEvent);
    }
        /// <summary>
        /// 解除事件监听
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="callback"></param>
        public void UnrigistEvent <T>(Action <T> callback) where T : GlobalEventHead
        {
            GlobalEvent current = new GlobalEvent();

            current.m_Type   = typeof(T);
            current.CallBack = callback;

            base.UnregistEvent(current);    //解除注册
        }
Exemple #19
0
 /// <summary>
 /// 安装+1马的方法
 /// </summary>
 /// <param name="aHorse">被安装的牌</param>
 /// <param name="aObj">游戏事件对象</param>
 /// <param name="aData">游戏数据</param>
 internal void LoadJia1(Card aHorse, GlobalEvent aObj, GlobalData aData)
 {
     if (Jia1Ma != null)
     {
         aObj.DropCards(true, GlobalEvent.CardFrom.Equipage, string.Empty, new Card[] { Jia1Ma }, Card.Effect.None, Chief, null, null);
     }
     Jia1Ma = aHorse;
     aObj.DropCards(false, GlobalEvent.CardFrom.None, string.Empty, new Card[] { aHorse }, aHorse.CardEffect, Chief, Chief, null);
 }
Exemple #20
0
    private static void OnSaveAssetsCallBack(string[] t)
    {
        List <string> paths = new List <string>();

        paths.AddRange(t);
        UpdateAsset(paths);

        GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnSaveAssets, t);
    }
Exemple #21
0
        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="data">GlobalEvent对象</param>
        private static void UpdateInfo(GlobalEvent data)
        {
            if (!data.NoSaveDB)
            {
                return;
            }

            // 更新数据
        }
Exemple #22
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="data">GlobalEvent对象</param>
        private static void DeleteInfo(GlobalEvent data)
        {
            if (!data.NoSaveDB)
            {
                return;
            }

            // 删除数据
        }
Exemple #23
0
    void initialiseEvents()
    {
        GlobalEvent globalEvent = new GlobalEvent();

        globalEvent.name        = "Hell";
        globalEvent.description = "Spawn a lot of lava";
        globalEvent.time        = 10000;
        globalEvents.Add(globalEvent);
    }
Exemple #24
0
    public override void Init()
    {
        s_world = m_world;
        //AddEntityCreaterLisnter();
        //AddEntityDestroyLisnter();

        GlobalEvent.AddTypeEvent <DebugMsg>(ReceviceDebugMsg);
        ApplicationManager.s_OnApplicationOnGUI += GUI;
    }
Exemple #25
0
        //args should not use object[], unncessesary boxing
        /// <summary>
        /// Subscribes to the specified event.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="a"></param>
        public static void Subscribe(GlobalEvent g, Action <object[]> a)
        {
            if (!_hasInitialized)
            {
                Initialize();
            }

            _events[(int)g].Add(a);
        }
Exemple #26
0
 public static void Clear()
 {
     _globalEvent.Clear();
     _globalEvent    = null;
     _randomUtil     = null;
     _gameData       = null;
     _blockGenerator = null;
     _excelUtil      = null;
 }
 public static bool AddListener(GlobalEvent globalEvent)
 {
     if (Instance != null)
     {
         Instance.GameManagerEvent += globalEvent;
         return(true);
     }
     return(false);
 }
Exemple #28
0
    public void Trigger(GlobalEvent e)
    {
        EventDelegate del;

        if (this.delegates.TryGetValue(e.GetType(), out del))
        {
            del.Invoke(e);
        }
    }
Exemple #29
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="data">GlobalEvent对象</param>
        private static void InsertInfo(GlobalEvent data)
        {
            if (!data.NoSaveDB)
            {
                return;
            }

            // 插入数据库
        }
Exemple #30
0
 public override void Dispose()
 {
     GlobalEvent.RemoveTypeEvent <SyncEntityMsg>(ReceviceSyncEntity);
     GlobalEvent.RemoveTypeEvent <PursueMsg>(RecevicePursueMsg);
     GlobalEvent.RemoveTypeEvent <DestroyEntityMsg>(ReceviceDestroyEntityMsg);
     GlobalEvent.RemoveTypeEvent <ChangeSingletonComponentMsg>(ReceviceChangeSingletonCompMsg);
     GlobalEvent.RemoveTypeEvent <StartSyncMsg>(ReceviceStartSyncMsg);
     GlobalEvent.RemoveTypeEvent <T>(ReceviceCommandMsg);
 }
Exemple #31
0
 public override void Init()
 {
     if (SDKManager.IncludeThePayPlatform(StoreName.UC))
     {
         Debug.Log("=========UC PayClass Init===========");
         GlobalEvent.AddTypeEvent <PrePay2Client>(OnPrePay);
         StorePayController.OnPayCallBack += OnPayResultCallBack;
     }
 }
 public static void AddEventHandler(string eventName, GlobalEvent handler)
 {
     if (!EventContainer.ContainsKey(eventName))
     {
         var list = new EventList(eventName){handler};
         EventContainer.Add(eventName, list);
     }
     else
         EventContainer[eventName].Add(handler);
 }
    public void LoadData()
    {
        ArrayList data = XMLHandler.LoadXML(dir+filename);

        if(data.Count > 0)
        {
            foreach(Hashtable entry in data)
            {
                if(entry[XMLHandler.NODE_NAME] as string == GlobalEventData.GLOBALEVENTS)
                {
                    if(entry.ContainsKey(XMLHandler.NODES))
                    {
                        ArrayList subs = entry[XMLHandler.NODES] as ArrayList;
                        name = new string[subs.Count/2];
                        globalEvent = new GlobalEvent[subs.Count/2];
                        foreach(Hashtable ht in subs)
                        {
                            if(ht[XMLHandler.NODE_NAME] as string == GlobalEventData.NAME)
                            {
                                int id = int.Parse((string)ht["id"]);
                                if(id < name.Length)
                                {
                                    name[id] = ht[XMLHandler.CONTENT] as string;
                                }
                            }
                            else if(ht[XMLHandler.NODE_NAME] as string == GlobalEventData.GLOBALEVENT)
                            {
                                int id = int.Parse((string)ht["id"]);
                                if(id < globalEvent.Length)
                                {
                                    globalEvent[id] = new GlobalEvent();
                                    globalEvent[id].SetData(ht);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Exemple #34
0
 /*
 ============================================================================
 Call global event functions
 ============================================================================
 */
 public void CallGlobalEvent(int id, int next)
 {
     this.currentStep = next;
     bool started = false;
     if(id < DataHolder.GlobalEvents().GetDataCount())
     {
         this.calledEvent = DataHolder.GlobalEvent(id).GetCopy();
         if(this.calledEvent.LoadEvent() &&
             this.calledEvent.StartFromEvent(this))
         {
             started = true;
         }
     }
     if(!started)
     {
         this.calledEvent = null;
         this.StepFinished(this.currentStep);
     }
 }
 public static void Trigger(GlobalEvent e)
 {
     Events.Trigger(e);
 }
Exemple #36
0
 public static GlobalEvent[] Remove(int index, GlobalEvent[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(GlobalEvent str in list) tmp.Add(str);
     tmp.RemoveAt(index);
     return tmp.ToArray(typeof(GlobalEvent)) as GlobalEvent[];
 }
Exemple #37
0
 public void GlobalEventFinished()
 {
     this.calledEvent = null;
     this.StepFinished(this.currentStep);
 }
Exemple #38
0
 public void StartEvent(GlobalEvent ge)
 {
     if(this.step.Length > 0 && !this.executing)
     {
         this.globalEvent = ge;
         this.StartEvent();
     }
 }
Exemple #39
0
 public GlobalEventArgs(GlobalEvent globalEvent)
 {
     GlobalEvent = globalEvent;
 }
 public void HandleEvent(GlobalEvent e)
 {
     EventsHandled += 1;
       GlobalEventStream.EventsDispatched += 1;
 }
Exemple #41
0
 public GlobalEvent GetCopy()
 {
     GlobalEvent ge = new GlobalEvent();
     ge.SetData(this.GetData(new Hashtable()));
     return ge;
 }
Exemple #42
0
 public static GlobalEvent[] Add(GlobalEvent n, GlobalEvent[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(GlobalEvent str in list) tmp.Add(str);
     tmp.Add(n);
     return tmp.ToArray(typeof(GlobalEvent)) as GlobalEvent[];
 }