示例#1
0
 public Server()
 {
     handles = new List<KeyValuePair<string, Action<object[]>>>();
     sceneManager = LocalServerSceneManager.Instance;
     sceneManager.Initialize();
     AddListeners();
 }
示例#2
0
文件: Server.cs 项目: mengtest/xxxxx
 public Server()
 {
     handles      = new List <KeyValuePair <string, Action <object[]> > >();
     sceneManager = LocalServerSceneManager.Instance;
     sceneManager.Initialize();
     AddListeners();
 }
        public void onActionDie(int entityID, int entityX, int entityY, int vocation)
        {
            Dictionary <int, int> tblDstDropsItem = new Dictionary <int, int>();
            List <int>            tblDstMoney     = new List <int>();

            MonsterData.getDrop(tblDstDropsItem, tblDstMoney, entityID, vocation);


            List <List <int> > args = new List <List <int> >();

            foreach (KeyValuePair <int, int> subDstDropsItem in tblDstDropsItem)
            {
                if (Mogo.GameLogic.LocalServer.LocalServerSceneManager.Instance.GetOneDropItemFromPool(subDstDropsItem.Key))
                {
                    List <int> subArgs     = new List <int>();
                    uint       newEntityId = LocalServerSceneManager.getNextEntityId();
                    subArgs.Add((int)CliEntityType.CLI_ENTITY_TYPE_DROP);
                    subArgs.Add((int)newEntityId);
                    subArgs.Add(entityX);
                    subArgs.Add(entityY);
                    subArgs.Add(0);
                    subArgs.Add(subDstDropsItem.Key);
                    subArgs.Add((int)MogoWorld.thePlayer.ID);

                    localDrops[newEntityId] = subArgs;
                    args.Add(subArgs);
                }
            }

            foreach (int money in tblDstMoney)
            {
                int realDropMoney = Mogo.GameLogic.LocalServer.LocalServerSceneManager.Instance.GetOneDropMoneyFromPool(money);
                if (realDropMoney > 0)
                {
                    List <int> subArgs     = new List <int>();
                    uint       newEntityId = LocalServerSceneManager.getNextEntityId();
                    subArgs.Add((int)CliEntityType.CLI_ENTITY_TYPE_DROP);
                    subArgs.Add((int)newEntityId);
                    subArgs.Add(entityX);
                    subArgs.Add(entityY);
                    subArgs.Add(money);
                    subArgs.Add(0);
                    subArgs.Add((int)MogoWorld.thePlayer.ID);

                    localDrops[newEntityId] = subArgs;
                    args.Add(subArgs);
                }
            }

            if (args.Count > 0)
            {
                LuaTable table;
                Mogo.RPC.Utils.PackLuaTable(args, out table);

                System.Object[] Arguments = { table };// new System.Object[1];
                //Arguments[0] = table;
                EventDispatcher.TriggerEvent <object[]>(Util.Utils.RPC_HEAD + "CreateCliEntityResp", Arguments);
            }
        }