Пример #1
0
 public void Decode(ByteStream stream)
 {
     this.m_data  = ByteStreamHelper.ReadDataReference(stream);
     this.m_count = stream.ReadInt();
     this.m_level = stream.ReadInt();
 }
Пример #2
0
 public LogicUnitSlot(LogicData data, int level, int count)
 {
     this.m_data  = data;
     this.m_level = level;
     this.m_count = count;
 }
Пример #3
0
 public void Destruct()
 {
     this.m_data = null;
 }
Пример #4
0
 public void AddEnabledData(LogicData data)
 {
     this.m_enabledData.Add(data);
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogicParticleEmitterData"/> class.
 /// </summary>
 public LogicParticleEmitterData(Row row, LogicDataTable dataTable) : base(row, dataTable)
 {
     LogicData.Load(this, this.GetType(), row);
 }
 public void SetOriginData(LogicData data)
 {
     this.m_originData = data;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="LogicUnitSlot" /> class.
 /// </summary>
 public LogicUnitProductionSlot(LogicData data, int count, bool terminate)
 {
     this._data      = data;
     this._count     = count;
     this._terminate = terminate;
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogicEnergyPackageData"/> class.
 /// </summary>
 public LogicEnergyPackageData(Row row, LogicDataTable dataTable) : base(row, dataTable)
 {
     LogicData.Load(this, this.GetType(), row);
 }
Пример #9
0
        /// <summary>
        ///     Decodes this instance.
        /// </summary>
        public override void Decode()
        {
            base.Decode();

            this.AccountId          = this.Stream.ReadLong();
            this.PassToken          = this.Stream.ReadString(900000);
            this.ClientMajorVersion = this.Stream.ReadInt();
            this.Stream.ReadInt();
            this.ClientBuildVersion = this.Stream.ReadInt();
            this.ResourceSha        = this.Stream.ReadString(900000);
            this.UDID       = this.Stream.ReadString(900000);
            this.OpenUDID   = this.Stream.ReadString(900000);
            this.MacAddress = this.Stream.ReadString(900000);
            this.Device     = this.Stream.ReadString(900000);

            if (!this.Stream.IsAtEnd())
            {
                this.PreferredLanguage       = this.Stream.ReadDataReference(1);
                this.PreferredDeviceLanguage = this.Stream.ReadString(900000);

                if (this.PreferredDeviceLanguage == null)
                {
                    this.PreferredDeviceLanguage = string.Empty;
                }

                if (!this.Stream.IsAtEnd())
                {
                    this.ADID = this.Stream.ReadString(900000);

                    if (!this.Stream.IsAtEnd())
                    {
                        this.OSVersion = this.Stream.ReadString(900000);

                        if (!this.Stream.IsAtEnd())
                        {
                            this.AndroidClient = this.Stream.ReadBoolean();

                            if (!this.Stream.IsAtEnd())
                            {
                                this.IMEI      = this.Stream.ReadStringReference(900000);
                                this.AndroidID = this.Stream.ReadStringReference(900000);

                                if (!this.Stream.IsAtEnd())
                                {
                                    this.Stream.ReadString(900000);

                                    if (!this.Stream.IsAtEnd())
                                    {
                                        this.AdvertisingEnabled = this.Stream.ReadBoolean();
                                        this.AdvertisingId      = this.Stream.ReadString(900000);

                                        if (!this.Stream.IsAtEnd())
                                        {
                                            this.ScramblerSeed = this.Stream.ReadInt();

                                            if (!this.Stream.IsAtEnd())
                                            {
                                                this.AppStore = this.Stream.ReadVInt();

                                                this.Stream.ReadStringReference(900000);
                                                this.Stream.ReadStringReference(900000);

                                                if (!this.Stream.IsAtEnd())
                                                {
                                                    this.Stream.ReadStringReference(900000);

                                                    if (!this.Stream.IsAtEnd())
                                                    {
                                                        this.KunlunSSO = this.Stream.ReadStringReference(900000);
                                                        this.KunlunUID = this.Stream.ReadStringReference(900000);

                                                        this.Stream.ReadVInt();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
 public virtual void CommodityCountChanged(int commodityType, LogicData data, int count)
 {
 }
Пример #11
0
 object Index(LogicData arg)
 {
     SetContentType(EFFC.Frame.Net.Base.Constants.GoResponseDataType.RazorView);
     Razor.SetViewPath("~/Views/Admin/main.cshtml");
     return(null);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LogicGlobalData"/> class.
 /// </summary>
 public LogicGlobalData(Row row, LogicDataTable dataTable) : base(row, dataTable)
 {
     LogicData.Load(this, this.GetType(), row);
 }
Пример #13
0
 /// <summary>
 ///     Decodes this instance.
 /// </summary>
 public void Decode(ByteStream stream)
 {
     this._data  = stream.ReadDataReference();
     this._count = stream.ReadInt();
     this._level = stream.ReadInt();
 }
Пример #14
0
 /// <summary>
 ///     Destructs this instance.
 /// </summary>
 public void Destruct()
 {
     this._data  = null;
     this._count = 0;
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogicExperienceLevelData"/> class.
 /// </summary>
 public LogicExperienceLevelData(Row row, LogicDataTable dataTable) : base(row, dataTable)
 {
     LogicData.Load(this, this.GetType(), row);
 }
Пример #16
0
 public void AddBuildingBoost(LogicData data, int count)
 {
     this.m_buildingBoostCost.Add(new LogicDataSlot(data, count));
 }
Пример #17
0
 public void SetPreferredTargetDamageMod(LogicData data, int preferredTargetDamageMod)
 {
     this.m_preferredTarget          = data;
     this.m_preferredTargetDamageMod = preferredTargetDamageMod;
 }
Пример #18
0
 public void AddTroopDiscount(LogicData data, int count)
 {
     this.m_troopDiscount.Add(new LogicDataSlot(data, count));
 }
Пример #19
0
 object load(LogicData arg)
 {
     SetContentType(EFFC.Frame.Net.Base.Constants.GoResponseDataType.RazorView);
     Razor.SetViewPath("~/Views/Busi/recommend_query.cshtml");
     return(null);
 }
        public static LogicClientHome GenerateBase(LogicGameObjectData gameObjectData)
        {
            LogicClientHome        logicClientHome        = new LogicClientHome();
            LogicGameMode          logicGameMode          = new LogicGameMode();
            LogicLevel             logicLevel             = logicGameMode.GetLevel();
            LogicGameObjectManager logicGameObjectManager = logicLevel.GetGameObjectManagerAt(0);

            logicLevel.SetLoadingVillageType(-1);
            logicLevel.SetVillageType(0);
            logicLevel.SetExperienceVersion(1);
            logicLevel.SetHomeOwnerAvatar(GameBaseGenerator.HomeOwnerAvatar);

            LogicBuilding townHall = new LogicBuilding(LogicDataTables.GetTownHallData(), logicLevel, 0);

            townHall.SetInitialPosition((LogicLevel.TILEMAP_SIZE_X / 2 - townHall.GetWidthInTiles() / 2) << 9, (LogicLevel.TILEMAP_SIZE_Y / 2 - townHall.GetHeightInTiles() / 2) << 9);
            townHall.SetUpgradeLevel(townHall.GetBuildingData().GetUpgradeLevelCount() - 1);

            logicGameObjectManager.AddGameObject(townHall, -1);

            LogicTownhallLevelData townhallLevelData = LogicDataTables.GetTownHallLevel(townHall.GetUpgradeLevel());

            if (gameObjectData == null)
            {
                LogicArrayList <LogicGameObject> scrambler = new LogicArrayList <LogicGameObject>();

                for (int i = 0; i < GameBaseGenerator.m_defenseBuildingArray.Size(); i++)
                {
                    LogicBuildingData buildingData = GameBaseGenerator.m_defenseBuildingArray[i];

                    for (int j = townhallLevelData.GetUnlockedBuildingCount(buildingData); j > 0; j--)
                    {
                        LogicBuilding logicBuilding =
                            (LogicBuilding)GameBaseGenerator.CreateAndPlaceRandomlyGameObject(buildingData, logicLevel, buildingData.GetWidth(), buildingData.GetHeight(), 0);

                        if (logicBuilding != null)
                        {
                            logicBuilding.SetLocked(false);
                            logicBuilding.SetUpgradeLevel(buildingData.GetUpgradeLevelCount() - 1);
                            scrambler.Add(logicBuilding);

                            int upgradeLevel             = buildingData.GetUpgradeLevelCount() - 1;
                            int minUpgradeLevelForGearUp = buildingData.GetMinUpgradeLevelForGearUp();

                            if (minUpgradeLevelForGearUp > -1 && upgradeLevel >= minUpgradeLevelForGearUp)
                            {
                                if (GameBaseGenerator.m_random.Rand(100) >= 50)
                                {
                                    logicBuilding.SetGearLevel(1);
                                }
                            }

                            if (buildingData.GetAttackerItemData(upgradeLevel).GetTargetingConeAngle() != 0)
                            {
                                logicBuilding.GetCombatComponent().ToggleAimAngle(buildingData.GetAimRotateStep() * GameBaseGenerator.m_random.Rand(360 / buildingData.GetAimRotateStep()), 0, false);
                            }

                            if (buildingData.GetAttackerItemData(upgradeLevel).HasAlternativeAttackMode())
                            {
                                if (minUpgradeLevelForGearUp > -1 && logicBuilding.GetGearLevel() != 1)
                                {
                                    continue;
                                }
                                if (GameBaseGenerator.m_random.Rand(100) >= 50)
                                {
                                    logicBuilding.GetCombatComponent().ToggleAttackMode(0, false);
                                }
                            }
                        }
                    }
                }

                for (int i = 0; i < GameBaseGenerator.m_otherBuildingArray.Size(); i++)
                {
                    LogicBuildingData buildingData = GameBaseGenerator.m_otherBuildingArray[i];

                    for (int j = townhallLevelData.GetUnlockedBuildingCount(buildingData); j > 0; j--)
                    {
                        LogicBuilding logicBuilding =
                            (LogicBuilding)GameBaseGenerator.CreateAndPlaceRandomlyGameObject(buildingData, logicLevel, buildingData.GetWidth(), buildingData.GetHeight(), 0);

                        if (logicBuilding != null)
                        {
                            logicBuilding.SetLocked(false);
                            logicBuilding.SetUpgradeLevel(buildingData.GetUpgradeLevelCount() - 1);
                            scrambler.Add(logicBuilding);
                        }
                    }
                }

                for (int i = 0; i < GameBaseGenerator.m_trapArray.Size(); i++)
                {
                    LogicTrapData trapData = (LogicTrapData)GameBaseGenerator.m_trapArray[i];

                    for (int j = townhallLevelData.GetUnlockedTrapCount(trapData); j > 0; j--)
                    {
                        LogicTrap trap = (LogicTrap)GameBaseGenerator.CreateAndPlaceRandomlyGameObject(trapData, logicLevel, trapData.GetWidth(), trapData.GetHeight(), 0);

                        if (trap != null)
                        {
                            trap.SetUpgradeLevel(trapData.GetUpgradeLevelCount() - 1);
                            scrambler.Add(trap);
                        }
                    }
                }

                for (int i = 0; i < scrambler.Size(); i++)
                {
                    LogicGameObject gameObject = scrambler[i];
                    LogicData       data       = gameObject.GetData();

                    int width  = gameObject.GetWidthInTiles();
                    int height = gameObject.GetHeightInTiles();
                    int x      = gameObject.GetX();
                    int y      = gameObject.GetY();

                    LogicArrayList <LogicGameObject> available = new LogicArrayList <LogicGameObject>();

                    for (int j = i + 1; j < scrambler.Size(); j++)
                    {
                        if (data != scrambler[j].GetData())
                        {
                            if (scrambler[j].GetWidthInTiles() == width && scrambler[j].GetHeightInTiles() == height)
                            {
                                available.Add(scrambler[j]);
                            }
                        }
                    }

                    if (available.Size() != 0)
                    {
                        LogicGameObject swapObj = available[GameBaseGenerator.m_random.Rand(available.Size())];

                        gameObject.SetInitialPosition(swapObj.GetX(), swapObj.GetY());
                        swapObj.SetInitialPosition(x, y);
                    }
                }
            }
            else
            {
                int maxUpgradeLevel = 0;
                int width           = 1;
                int height          = 1;

                switch (gameObjectData.GetDataType())
                {
                case LogicDataType.BUILDING:
                {
                    LogicBuildingData logicBuildingData = (LogicBuildingData)gameObjectData;
                    maxUpgradeLevel = logicBuildingData.GetUpgradeLevelCount();
                    width           = logicBuildingData.GetWidth();
                    height          = logicBuildingData.GetHeight();
                    break;
                }

                case LogicDataType.TRAP:
                    LogicTrapData logicTrapData = (LogicTrapData)gameObjectData;
                    maxUpgradeLevel = logicTrapData.GetUpgradeLevelCount();
                    width           = logicTrapData.GetWidth();
                    height          = logicTrapData.GetHeight();
                    break;
                }

                int upgLevel = maxUpgradeLevel - 1;
                int x        = 0;
                int y        = 0;

                while (true)
                {
                    LogicBuilding building =
                        (LogicBuilding)GameBaseGenerator.CreateGameObjectIfAnyPlaceExist(gameObjectData, logicLevel, width, height, 0, x, y);

                    if (building == null)
                    {
                        break;
                    }

                    building.SetLocked(false);
                    building.SetUpgradeLevel(upgLevel != -1 ? upgLevel : GameBaseGenerator.m_random.Rand(building.GetUpgradeLevel()));
                    x = building.GetTileX();
                    y = building.GetTileY();
                }
            }

            for (int i = 0; i < 10; i++)
            {
                logicGameObjectManager.Village1CreateObstacle();
            }

            LogicJSONObject jsonObject = new LogicJSONObject();

            logicGameMode.SaveToJSON(jsonObject);
            logicGameMode.Destruct();

            logicClientHome.SetHomeJSON(LogicJSONParser.CreateJSONString(jsonObject, 2048));

            CompressibleStringHelper.Compress(logicClientHome.GetCompressibleHomeJSON());

            return(logicClientHome);
        }