コード例 #1
0
        public virtual void Load(LogicJSONObject jsonObject)
        {
            LogicJSONNumber senderAvatarIdHighObject = jsonObject.GetJSONNumber("sender_avatar_id_high");
            LogicJSONNumber senderAvatarIdLowObject  = jsonObject.GetJSONNumber("sender_avatar_id_low");

            if (senderAvatarIdHighObject != null && senderAvatarIdLowObject != null)
            {
                this.m_senderAvatarId = new LogicLong(senderAvatarIdHighObject.GetIntValue(), senderAvatarIdLowObject.GetIntValue());
            }

            LogicJSONNumber senderHomeIdHighObject = jsonObject.GetJSONNumber("sender_home_id_high");
            LogicJSONNumber senderHomeIdLowObject  = jsonObject.GetJSONNumber("sender_home_id_low");

            if (senderHomeIdHighObject != null && senderHomeIdLowObject != null)
            {
                this.m_senderHomeId = new LogicLong(senderHomeIdHighObject.GetIntValue(), senderHomeIdLowObject.GetIntValue());
            }


            this.m_senderName       = LogicJSONHelper.GetString(jsonObject, "sender_name");
            this.m_senderLevel      = LogicJSONHelper.GetInt(jsonObject, "sender_level");
            this.m_senderLeagueType = LogicJSONHelper.GetInt(jsonObject, "sender_league_type");
            this.m_senderRole       = (LogicAvatarAllianceRole)LogicJSONHelper.GetInt(jsonObject, "sender_role");
            this.m_removed          = LogicJSONHelper.GetBool(jsonObject, "removed");
        }
コード例 #2
0
        public void Load(LogicJSONObject jsonObject)
        {
            this.m_json = jsonObject;

            if (jsonObject != null)
            {
                LogicJSONObject village1Object = jsonObject.GetJSONObject("Village1");
                Debugger.DoAssert(village1Object != null, "pVillage1 = NULL!");

                LogicJSONString specialObstacleObject = village1Object.GetJSONString("SpecialObstacle");

                if (specialObstacleObject != null)
                {
                    this.m_specialObstacle = LogicDataTables.GetObstacleByName(specialObstacleObject.GetStringValue(), null);
                }

                LogicJSONObject village2Object = jsonObject.GetJSONObject("Village2");
                Debugger.DoAssert(village2Object != null, "pVillage2 = NULL!");

                this.m_maxTownHallLevel = LogicJSONHelper.GetInt(village2Object, "TownHallMaxLevel");

                LogicJSONArray scoreChangeForLosingArray = village2Object.GetJSONArray("ScoreChangeForLosing");
                Debugger.DoAssert(scoreChangeForLosingArray != null, "ScoreChangeForLosing array is null");

                this.m_milestoneScoreChangeForLosing  = new LogicArrayList <int>(scoreChangeForLosingArray.Size());
                this.m_percentageScoreChangeForLosing = new LogicArrayList <int>(scoreChangeForLosingArray.Size());

                for (int i = 0; i < scoreChangeForLosingArray.Size(); i++)
                {
                    LogicJSONObject obj = scoreChangeForLosingArray.GetJSONObject(i);

                    if (obj != null)
                    {
                        LogicJSONNumber milestoneObject  = obj.GetJSONNumber("Milestone");
                        LogicJSONNumber percentageObject = obj.GetJSONNumber("Percentage");

                        if (milestoneObject != null && percentageObject != null)
                        {
                            this.m_milestoneScoreChangeForLosing.Add(milestoneObject.GetIntValue());
                            this.m_percentageScoreChangeForLosing.Add(percentageObject.GetIntValue());
                        }
                    }
                }

                LogicJSONArray strengthRangeForScoreArray = village2Object.GetJSONArray("StrengthRangeForScore");
                Debugger.DoAssert(strengthRangeForScoreArray != null, "StrengthRangeForScore array is null");

                this.m_milestoneStrengthRangeForScore  = new LogicArrayList <int>(strengthRangeForScoreArray.Size());
                this.m_percentageStrengthRangeForScore = new LogicArrayList <int>(strengthRangeForScoreArray.Size());

                for (int i = 0; i < strengthRangeForScoreArray.Size(); i++)
                {
                    LogicJSONObject obj = strengthRangeForScoreArray.GetJSONObject(i);

                    if (obj != null)
                    {
                        LogicJSONNumber milestoneObject  = obj.GetJSONNumber("Milestone");
                        LogicJSONNumber percentageObject = obj.GetJSONNumber("Percentage");

                        if (milestoneObject != null && percentageObject != null)
                        {
                            this.m_milestoneStrengthRangeForScore.Add(milestoneObject.GetIntValue());
                            this.m_percentageStrengthRangeForScore.Add(percentageObject.GetIntValue());
                        }
                    }
                }

                LogicJSONObject killSwitchesObject = jsonObject.GetJSONObject("KillSwitches");
                Debugger.DoAssert(killSwitchesObject != null, "pKillSwitches = NULL!");

                this.m_battleWaitForProjectileDestruction = LogicJSONHelper.GetBool(killSwitchesObject, "BattleWaitForProjectileDestruction");
                this.m_battleWaitForDieDamage             = LogicJSONHelper.GetBool(killSwitchesObject, "BattleWaitForDieDamage");

                LogicJSONObject globalsObject = jsonObject.GetJSONObject("Globals");
                Debugger.DoAssert(globalsObject != null, "pGlobals = NULL!");

                this.m_giftPackExtension = LogicJSONHelper.GetString(globalsObject, "GiftPackExtension");

                this.m_duelLootLimitCooldownInMinutes = LogicJSONHelper.GetInt(globalsObject, "DuelLootLimitCooldownInMinutes");
                this.m_duelBonusLimitWinsPerDay       = LogicJSONHelper.GetInt(globalsObject, "DuelBonusLimitWinsPerDay");
                this.m_duelBonusPercentWin            = LogicJSONHelper.GetInt(globalsObject, "DuelBonusPercentWin");
                this.m_duelBonusPercentLose           = LogicJSONHelper.GetInt(globalsObject, "DuelBonusPercentLose");
                this.m_duelBonusPercentDraw           = LogicJSONHelper.GetInt(globalsObject, "DuelBonusPercentDraw");
                this.m_duelBonusMaxDiamondCostPercent = LogicJSONHelper.GetInt(globalsObject, "DuelBonusMaxDiamondCostPercent");
            }
            else
            {
                Debugger.Error("pConfiguration = NULL!");
            }
        }