コード例 #1
0
        private void ProcessEvent_Playfield_List(PlayfieldList playfieldList)
        {
            // from Request_Playfield_List
            DebugLog("Event_Playfield_List - Playfield list count: {0}", (playfieldList != null) ? playfieldList.playfields.Count : 0);

            //if (playfieldList != null)
            //{
            //    lock (_playfieldsByName)
            //    {
            //        foreach (string s in playfieldList.playfields)
            //        {
            //            DebugLog("  {0}", s);
            //            SendRequest<Eleon.Modding.PlayfieldStats>(Eleon.Modding.CmdId.Request_Playfield_Stats, new Eleon.Modding.PString(s))
            //                 .ContinueWith((task) => this.ProcessEvent_Playfield_Stats(task.Result));
            //        }
            //    }
            //}
        }
コード例 #2
0
        public void Game_Event(CmdId eventId, ushort seqNr, object data)
        {
            //Console.WriteLine("Game_Event: {0} : {1}",eventId, data);
            try
            {
                switch (eventId)
                {
                case CmdId.Event_GlobalStructure_List:
                {
                    sList = (GlobalStructureInfo)data;
                    //pInfo.playfield
                    foreach (var h in sList.)
                    {
                        h.Value.ForEach(Action <GlobalStructureInfo>).;
                    }
                    pInfo.playfield.SpawnTestPlayer(new Vector3(0, 0, 0));
                }
                break;

                case CmdId.Event_Playfield_List:
                {
                    PlayfieldList pList = (PlayfieldList)data;
                    foreach (var a in pList.playfields)
                    {
                        a.
                        Console.WriteLine("Playfields Loaded{0}", plist);
                    }
                }
                break;
                }
            }

            catch (Exception ex)
            {
                legacyModApi.Console_Write(ex.Message);
            }
        }
コード例 #3
0
        public void Game_Event(CmdId eventId, ushort seqNr, object data)
        {
            try
            {
                switch (eventId)
                {
                case    CmdId.Event_Playfield_Loaded:
                {
                    mGameAPI.Console_Write("Event_Playfield_Loaded actually happens");
                    break;
                }

                case    CmdId.Event_Playfield_List:
                {
                    PlayfieldList pfl = data as PlayfieldList;
                    foreach (string pf in pfl.playfields)
                    {
                        mGameAPI.Console_Write("Playfield: " + pf);
                    }
                }
                break;

                case    CmdId.Event_GlobalStructure_List:
                {
                    HandleGlobalStructureList(data as GlobalStructureList);
                }
                break;

                case    CmdId.Event_Structure_BlockStatistics:
                {
                    IdStructureBlockInfo idsbi = (IdStructureBlockInfo)data;
                    mGameAPI.Console_Write("Got block stats for id: " + idsbi.id);
                    foreach (KeyValuePair <int, int> stat in idsbi.blockStatistics)
                    {
                        if (stat.Key == SolarBattery)
                        {
                            mGameAPI.Console_Write("Building has " + stat.Value + " solar batteries...");
                        }
                    }
                }
                break;

                case    CmdId.Event_ChatMessage:
                {
                    ChatInfo ci = (ChatInfo)data;
                    if (ci == null)
                    {
                        break;
                    }

                    if (ci.type != 8 && ci.type != 7 && ci.msg == "!MODS")
                    {
                        PrivateMessage(ci.playerId, "Solar Helper by Kharzette");
                    }
                }
                break;

                case CmdId.Event_Playfield_Entity_List:
                {
                    PlayfieldEntityList pfel = (PlayfieldEntityList)data;
                    if (pfel == null)
                    {
                        break;
                    }

                    mGameAPI.Console_Write("Entity list for playfield " + pfel.playfield);
                    foreach (EntityInfo ei in pfel.entities)
                    {
                        mGameAPI.Console_Write("ID: " + ei.id + ", Pos: " + ei.pos + ", Type: " + ei.type);
                    }
                }
                break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                mGameAPI.Console_Write(ex.Message);
            }
        }