示例#1
0
        private void DoReadPlanetBattleUpdate()
        {
            int  LPLanet   = FReader.ReadInt32();
            bool LInBattle = FReader.ReadBoolean();

            PlanetByUID(LPLanet).UpdateBattle(LInBattle);
        }
示例#2
0
        private void DoReadShipRemove()
        {
            int  LUID     = FReader.ReadInt32();
            bool LDestroy = FReader.ReadBoolean();

            LandingByUID(LUID).Ship.Delete(LDestroy);
        }
示例#3
0
        private void DoReadPlanetSubscriptionChanged()
        {
            int  LPLanet     = FReader.ReadInt32();
            bool LSubscribed = FReader.ReadBoolean();

            PlanetByUID(LPLanet).UpdateSubscription(LSubscribed);
        }
示例#4
0
        private void DoReadShipCreate()
        {
            int     tmpUID     = FReader.ReadInt32();
            Landing tmpLanding = LandingByUID(tmpUID);

            /* пересмотреть логику */
            if (tmpLanding.Ship != null)
            {
                return;
            }
            Player   LOwner    = SSHShared.FindPlayer(FReader.ReadInt32());
            ShipType LShipType = (ShipType)FReader.ReadInt32();
            Ship     LShip     = new Ship(tmpUID, LOwner, tmpLanding, LShipType)
            {
                State          = (ShipState)FReader.ReadInt32(),
                Mode           = (ShipMode)FReader.ReadInt32(),
                AttachedPlanet = PlanetByUID(FReader.ReadInt32()),
                Count          = FReader.ReadInt32(),
                HP             = FReader.ReadInt32(),
                Fuel           = FReader.ReadInt32(),
                IsCapture      = FReader.ReadBoolean(),
                IsAutoTarget   = FReader.ReadBoolean(),
            };

            LShip.Allocate();
        }
示例#5
0
        private void DoReadPlanetStorageResize()
        {
            int  LPLanet = FReader.ReadInt32();
            int  LSize   = FReader.ReadInt32();
            bool LClear  = FReader.ReadBoolean();

            PlanetByUID(LPLanet).UpdateStorageSize(LSize, LClear);
        }
示例#6
0
        private void DoReadLowGravityUpdate()
        {
            Planet LSource  = PlanetByUID(FReader.ReadInt32());
            bool   LEnabled = FReader.ReadBoolean();

            // Включим или выключим гравитационный потенциал
            LSource.LowGravity(LEnabled);
        }
示例#7
0
        private void DoReadPlanetCoverageUpdate()
        {
            int     LPlanet    = FReader.ReadInt32();
            bool    LIncrement = FReader.ReadBoolean();
            SSHRole LRole      = (SSHRole)FReader.ReadInt32();

            PlanetByUID(LPlanet).UpdateCoverage(LIncrement, LRole);
        }
示例#8
0
        private void DoReadPlanetVisibilityUpdate()
        {
            int  LPlanet    = FReader.ReadInt32();
            bool LHardLight = FReader.ReadBoolean();
            bool LIncrement = FReader.ReadBoolean();

            PlanetByUID(LPlanet).UpdateVisibility(LHardLight, LIncrement);
        }
示例#9
0
        private void DoReadShipAttach()
        {
            Ship   LShip       = LandingByUID(FReader.ReadInt32()).Ship;
            Planet LPlanet     = PlanetByUID(FReader.ReadInt32());
            bool   LCapture    = FReader.ReadBoolean();
            bool   LAutoTarget = FReader.ReadBoolean();

            LShip.UpdateAttach(LPlanet, LCapture, LAutoTarget);
        }
示例#10
0
        private void DoReadPlanetStorageUpdate()
        {
            int  LPlanet = FReader.ReadInt32();
            int  LIndex  = FReader.ReadInt32();
            int  LResID  = FReader.ReadInt32();
            int  LCount  = FReader.ReadInt32();
            int  LFlags  = FReader.ReadInt32();
            bool LActive = FReader.ReadBoolean();

            Engine.UIPlanetDetails.Storage.Change(LPlanet, LIndex, LResID, LCount, LFlags, LActive);
        }
示例#11
0
        private void DoReadPortalOpen()
        {
            Planet  LSource    = PlanetByUID(FReader.ReadInt32());
            Planet  LTarget    = PlanetByUID(FReader.ReadInt32());
            bool    LBreakable = FReader.ReadBoolean();
            int     LLimit     = FReader.ReadInt32();
            SSHRole LRole      = SSHRole.Neutral;

            // Если не БЧТ - то нужна роль портала
            if (LSource.PlanetType != PlanetType.Hole)
            {
                LRole = (SSHRole)FReader.ReadInt32();
            }
            // Откроем портал
            LSource.PortalOpen(LTarget, LBreakable, LLimit, LRole);
        }
示例#12
0
        private void DoReadPlanetarLoadPlanets()
        {
            int LCount = FReader.ReadInt32();

            // Создадим координатную сетку
            for (int LSectorX = 0; LSectorX < Engine.MapSize.x; LSectorX++)
            {
                for (int LSectorY = 0; LSectorY < Engine.MapSize.y; LSectorY++)
                {
                    new Grid(Engine.UIPanelGrid, LSectorX, LSectorY);
                }
            }
            // Загрузка планет
            for (int LIndex = 0; LIndex < LCount; LIndex++)
            {
                int    LUID    = FReader.ReadInt32();
                int    LPosX   = FReader.ReadInt32();
                int    LPosY   = FReader.ReadInt32();
                int    LType   = FReader.ReadInt32();
                int    LMode   = FReader.ReadInt32();
                Planet LPlanet = new Planet(LUID, Engine.UIBattlefield, LPosX, LPosY, (PlanetType)LType, (PlanetMode)LMode)
                {
                    Owner             = SSHShared.FindPlayer(FReader.ReadInt32()),
                    State             = (PlanetState)FReader.ReadInt32(),
                    VisibleHard       = FReader.ReadBoolean(),
                    VisibleSoft       = FReader.ReadBoolean(),
                    IsCoverageSelf    = FReader.ReadBoolean(),
                    IsCoverageFriends = FReader.ReadBoolean(),
                    IsCoverageEnemy   = FReader.ReadBoolean(),
                };
                LPlanet.Allocate();
            }
            // Загрузка ссылок
            for (int LIndex = 0; LIndex < LCount; LIndex++)
            {
                int LLinkCount = FReader.ReadInt32();
                for (int LLink = 0; LLink < LLinkCount; LLink++)
                {
                    Engine.MapPlanets[LIndex].Links.Add(Engine.MapPlanets[FReader.ReadInt32()]);
                }
            }
        }
示例#13
0
 private void DoReadPlayerTechBuildingCreate()
 {
     // Перебор всех строений
     foreach (BuildingType LBuildingType in Enum.GetValues(typeof(BuildingType)))
     {
         if (LBuildingType == BuildingType.Empty)
         {
             continue;
         }
         // Перебор всех технологий
         foreach (BuildingTech LTech in Enum.GetValues(typeof(BuildingTech)))
         {
             if (LTech == BuildingTech.Empty)
             {
                 continue;
             }
             TechInfo LTechInfo = new TechInfo();
             LTechInfo.Supported = FReader.ReadBoolean();
             if (LTechInfo.Supported)
             {
                 // Сбор сведений
                 LTechInfo.Name   = LTech.ToString();
                 LTechInfo.Level  = FReader.ReadInt32();
                 LTechInfo.Count  = FReader.ReadInt32();
                 LTechInfo.Levels = new int[6];/*TODO count*/
                 // Перебор уровней технологий
                 for (int LIndex = 0; LIndex <= 5; LIndex++)
                 {
                     LTechInfo.Levels[LIndex] = FReader.ReadInt32();
                 }
                 // Установим текущее значение техи
                 LTechInfo.Value = LTechInfo.Levels[LTechInfo.Level];
             }
             Engine.TechBuilding(LBuildingType, LTech, LTechInfo);
         }
     }
 }
示例#14
0
 private void DoReadPlayerTechShipCreate()
 {
     // Перебор всех корабликов
     foreach (ShipType LShip in Enum.GetValues(typeof(ShipType)))
     {
         if (LShip == ShipType.Empty)
         {
             continue;
         }
         // Перебор всех технологий
         foreach (ShipTech LTech in Enum.GetValues(typeof(ShipTech)))
         {
             if (LTech == ShipTech.Empty)
             {
                 continue;
             }
             TechInfo LTechInfo = new TechInfo();
             LTechInfo.Supported = FReader.ReadBoolean();
             if (LTechInfo.Supported)
             {
                 // Сбор сведений
                 LTechInfo.Name   = LTech.ToString();
                 LTechInfo.Level  = FReader.ReadInt32();
                 LTechInfo.Count  = FReader.ReadInt32();
                 LTechInfo.Levels = new int[LTechInfo.Count + 1];
                 // Перебор уровней технлогий
                 for (int LIndex = 0; LIndex <= LTechInfo.Count; LIndex++)
                 {
                     LTechInfo.Levels[LIndex] = FReader.ReadInt32();
                 }
                 // Установим текущее значение техи
                 LTechInfo.Value = LTechInfo.Levels[LTechInfo.Level];
             }
             Engine.TechShip(LShip, LTech, LTechInfo);
         }
     }
 }