Example #1
0
    /// <summary>
    /// 选择强化物界面ok按钮回调用
    /// </summary>
    void SelectUIOkBtnCallback(int selectObj)
    {
        //设置当前选择的强化物
        PropsData pData = SwapModel.GetInstance().GetObj(selectObj).GetComponent <PropsObject>().pData;

        SwapModel.GetInstance().CurReinforcement = new Reinforcement(pData);
        ResetAll();
    }
Example #2
0
 protected override void Awake()
 {
     base.Awake();
     Debug.Log(11111);
     modelsData        = new ModelsData();
     modelsData.models = new ModelEntity[4];
     for (int i = 0; i < 4; i++)
     {
         modelsData.models[i] = Resources.Load <ModelEntity>("Data/Entity/Models/ModelEntity0" + (i + 1));
     }
     propsData           = new PropsData();
     propsData.medicines = new PropEntity[2];
     for (int i = 0; i < 2; i++)
     {
         propsData.medicines[i] = Resources.Load <PropEntity>("Data/Entity/Props/Prop_Medicine_0" + (i + 1));
     }
     equipsData         = new EquipsData();
     equipsData.weapons = new EquipEntity[2];
     for (int i = 0; i < 2; i++)
     {
         equipsData.weapons[i] = Resources.Load <EquipEntity>("Data/Entity/Equips/Equip_Weapon_0" + (i + 1));
     }
     equipsData.headers = new EquipEntity[1];
     for (int i = 0; i < equipsData.headers.Length; i++)
     {
         equipsData.headers[i] = Resources.Load <EquipEntity>("Data/Entity/Equips/Equip_Header_0" + (i + 1));
     }
     skillsData            = new SkillsData();
     skillsData.skillType1 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType1.Length; i++)
     {
         skillsData.skillType1[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type1_0" + (i + 1));
     }
     skillsData.skillType2 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType2.Length; i++)
     {
         skillsData.skillType2[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type2_0" + (i + 1));
     }
     skillsData.skillType3 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType3.Length; i++)
     {
         skillsData.skillType3[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type3_0" + (i + 1));
     }
     skillsData.skillType4 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType4.Length; i++)
     {
         skillsData.skillType4[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type4_0" + (i + 1));
     }
     skillsData.skillType5 = new SkillEntity[8];
     for (int i = 0; i < skillsData.skillType5.Length; i++)
     {
         skillsData.skillType5[i] = Resources.Load <SkillEntity>("Data/Entity/Skills/Skill_Type5_0" + (i + 1));
     }
     Constant.InitDescriptions();
     baseAbilityDes = Constant.baseAbilityDes;
 }
Example #3
0
    public PropsLogicObject(PropsData data)
    {
        this.m_Data      = data;
        this.m_LogicData = new PropsLogicData(data);

        if (this.m_Data.RemainingCD != 0)
        {
            this.m_CDComponent = new CDComponent(data, LogicTimer.Instance.CurrentTime);
            this.AddComponent(this.m_CDComponent);
            this.m_CDComponent.CDFinished += CDFinished;
        }
    }
Example #4
0
    public void GenerateProps(int propsNo, PropsType propsType)
    {
        PropsData       data       = new PropsData();
        PropsConfigData configData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(propsType);

        data.PropsNo          = propsNo;
        data.RemainingUseTime = configData.MaxUseTimes;
        data.RemainingCD      = configData.CD;
        data.PropsConfigData  = configData;
        data.PropsType        = propsType;
        data.IsInBattle       = false;

        PropsLogicObject logicObject = new PropsLogicObject(data);

        this.m_Props.Add(propsNo, logicObject);
    }
Example #5
0
        private PropsData GetPropsData(Props props)
        {
            var builder = PropsData.CreateBuilder()
                          .SetClazz(props.Type.AssemblyQualifiedName)
                          .SetDeploy(GetDeployData(props.Deploy));

            foreach (object arg in props.Arguments)
            {
                if (arg == null)
                {
                    builder = builder.AddArgs(ByteString.Empty);
                    builder = builder.AddClasses("");
                }
                else
                {
                    builder = builder.AddArgs(Serialize(arg));
                    builder = builder.AddClasses(arg.GetType().AssemblyQualifiedName);
                }
            }

            return(builder.Build());
        }
Example #6
0
        private void miProps_Click(object sender, System.EventArgs e)
        {
            GetDatafile msg = new GetDatafile();

            Pandora.Profile.Server.FillBoxMessage(msg);
            msg.DataType = BoxDatafile.PropsData;

            BoxServerForm form = new BoxServerForm(msg);

            if (form.ShowDialog() == DialogResult.OK)
            {
                ReturnDatafile data = form.Response as ReturnDatafile;

                if (data != null)
                {
                    PropsData props = data.Data as PropsData;

                    if (props != null)
                    {
                        PropsData.Props = props;
                    }
                }
            }
        }
    private void ReceivedUserData(Hashtable result)
    {
        Debug.Log("received");

        LoginResponseParameter response = new LoginResponseParameter();

        response.InitialParameterObjectFromHashtable(result);
        if (response.FailType.HasValue)
        {
            Debug.Log(response.FailType.ToString());
            if (response.FailType == LoginFailType.BeAttacked)
            {
                this.m_ProgressBar.gameObject.SetActive(false);
                this.m_WaitingBehavior.Show();
            }
        }
        else
        {
            LoginSuccessResponseParameter paramter = response.Response;

            if (!string.IsNullOrEmpty(paramter.PlayerAccountID))
            {
                if (CommonHelper.PlatformType == PlatformType.Nd)
                {
                    NdAccountUtility.Instance.InitialAccount(paramter.PlayerAccountID);
                }
            }

            PlayerConfigData playerConfigData = ConfigUtilities.ConfigInterface.Instance.PlayerConfigHelper.GetPlayerData(paramter.PlayerLevel);

            UserData userData = new UserData();
            userData.PlayerID             = paramter.PlayerID;
            userData.Name                 = paramter.PlayerName;
            userData.Level                = paramter.PlayerLevel;
            userData.Exp                  = paramter.PlayerExp;
            userData.ConfigData           = playerConfigData;
            userData.Honour               = paramter.PlayerHonour;
            userData.CurrentStoreGold     = paramter.PlayerGold;
            userData.CurrentStoreFood     = paramter.PlayerFood;
            userData.CurrentStoreOil      = paramter.PlayerOil;
            userData.CurrentStoreGem      = paramter.PlayerGem;
            userData.RemainingCD          = paramter.PlayerShieldRemainSecond;
            userData.PlunderTotalGold     = paramter.PlunderTotalGold;
            userData.PlunderTotalFood     = paramter.PlunderTotalFood;
            userData.PlunderTotalOil      = paramter.PlunderTotalOil;
            userData.RemoveTotalObject    = paramter.RemoveTotalObject;
            userData.IsRegisterSuccessful = paramter.IsRegistered;
            userData.IsNewbie             = paramter.IsNewbie;
            userData.DestoryBuildings     = new Dictionary <BuildingType, int>();
            for (int i = 0; i < (int)BuildingType.Length; i++)
            {
                BuildingType type = (BuildingType)i;
                if (paramter.DestroyBuildingDict != null && paramter.DestroyBuildingDict.ContainsKey(type))
                {
                    userData.DestoryBuildings.Add(type, paramter.DestroyBuildingDict[type]);
                }
                else
                {
                    userData.DestoryBuildings.Add(type, 0);
                }
            }
            userData.ProduceArmies = new Dictionary <ArmyType, int>();
            for (int i = 0; i < (int)ArmyType.Length; i++)
            {
                ArmyType type = (ArmyType)i;
                if (paramter.ProduceArmyDict != null && paramter.ProduceArmyDict.ContainsKey(type))
                {
                    userData.ProduceArmies.Add(type, paramter.ProduceArmyDict[type]);
                }
                else
                {
                    userData.ProduceArmies.Add(type, 0);
                }
            }

            userData.ArmyProgress = new Dictionary <ArmyType, ProgressInformation>();
            foreach (ArmyProgressParameter param in paramter.ArmiesProgress)
            {
                ProgressInformation progressInfo = new ProgressInformation()
                {
                    Level = param.ArmyLevel, StartNo = param.ArmyStartNO
                };
                userData.ArmyProgress.Add(param.ArmyType, progressInfo);
            }

            userData.ItemProgress = new Dictionary <ItemType, ProgressInformation>();
            foreach (ItemProgressParameter param in paramter.ItemsProgress)
            {
                ProgressInformation progressInfo = new ProgressInformation()
                {
                    Level = param.ItemLevel, StartNo = param.ItemStartNO
                };
                userData.ItemProgress.Add(param.ItemType, progressInfo);
            }

            userData.MercenaryProgress = new Dictionary <MercenaryType, int>();
            foreach (MercenaryProgressParameter param in paramter.MercenaryProgress)
            {
                userData.MercenaryProgress.Add(param.MercenaryType, param.MercenaryStartNO);
            }

            userData.AttackLogs = new List <LogData>();
            foreach (MatchLogParameter param in paramter.AttackLog)
            {
                userData.AttackLogs.Add(this.GenerateLogData(param));
            }

            userData.DefenseLogs = new List <LogData>();
            foreach (MatchLogParameter param in paramter.DefenseLog)
            {
                userData.DefenseLogs.Add(this.GenerateLogData(param));
            }

            userData.PlayerBuffs = new List <BuffData>();
            foreach (PlayerBuffParameter param in paramter.Buffs)
            {
                BuffData buffData = new BuffData();
                buffData.RelatedPropsType = param.RelatedProps;
                buffData.RemainingCD      = param.RemainingTime;
                buffData.BuffConfigData   = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(param.RelatedProps).FunctionConfigData as PropsBuffConfigData;
                userData.PlayerBuffs.Add(buffData);
            }

            List <BuildingData>            buildings   = new List <BuildingData>();
            Dictionary <int, BuildingData> builderHuts = new Dictionary <int, BuildingData>();

            List <ArmyData> armies = new List <ArmyData>();
            List <ItemData> items  = new List <ItemData>();
            List <ObjectUpgrade <ArmyType> > armyUpgrades             = new List <ObjectUpgrade <ArmyType> >();
            List <ObjectUpgrade <ItemType> > itemUpgrades             = new List <ObjectUpgrade <ItemType> >();
            Dictionary <MercenaryIdentity, MercenaryData> mercenaries = new Dictionary <MercenaryIdentity, MercenaryData>();
            foreach (BuildingParameter param in paramter.Buildings)
            {
                BuildingData data = this.GenerateBuildingData(param, armies, items, mercenaries, armyUpgrades, itemUpgrades, userData);
                buildings.Add(data);
                if (data.BuildingID.buildingType == BuildingType.BuilderHut)
                {
                    builderHuts.Add(data.BuildingID.buildingNO, data);
                }
            }

            for (int i = 0; i < buildings.Count; i++)
            {
                BuildingData      buildingData = buildings[i];
                BuildingParameter param        = paramter.Buildings[i];
                if (param.BuilderBuildingNO.HasValue)
                {
                    /*
                     * int builderLevel = builderHuts[param.BuilderBuildingNO.Value].Level;
                     * BuilderConfigData builderData = ConfigInterface.Instance.BuilderConfigHelper.GetBuilderData(builderLevel);
                     * buildingData.ActorWorkEfficiency = builderData.BuildEfficiency;
                     */
                    buildingData.BuilderBuildingNO = param.BuilderBuildingNO.Value;
                }

                if (buildingData.ConfigData.ProduceGoldEfficiency == 0 && buildingData.Level > 0)
                {
                    userData.GoldMaxCapacity += buildingData.ConfigData.StoreGoldCapacity;
                }
                if (buildingData.ConfigData.ProduceFoodEfficiency == 0 && buildingData.Level > 0)
                {
                    userData.FoodMaxCapacity += buildingData.ConfigData.StoreFoodCapacity;
                }
                if (buildingData.ConfigData.ProduceOilEfficiency == 0 && buildingData.Level > 0)
                {
                    userData.OilMaxCapacity += buildingData.ConfigData.StoreOilCapacity;
                }
                if (buildingData.ConfigData.CanStoreProps)
                {
                    userData.PropsMaxCapacity += buildingData.ConfigData.StorePropsCapacity;
                }
            }

            foreach (BuildingData buildingData in buildings)
            {
                if (buildingData.ConfigData.StoreGoldCapacity > 0 && buildingData.ConfigData.ProduceGoldEfficiency == 0)
                {
                    buildingData.CurrentStoreGold = userData.CurrentStoreGold * buildingData.ConfigData.StoreGoldCapacity / userData.GoldMaxCapacity;
                }
                if (buildingData.ConfigData.StoreFoodCapacity > 0 && buildingData.ConfigData.ProduceFoodEfficiency == 0)
                {
                    buildingData.CurrentStoreFood = userData.CurrentStoreFood * buildingData.ConfigData.StoreFoodCapacity / userData.FoodMaxCapacity;
                }
                if (buildingData.ConfigData.StoreOilCapacity > 0 && buildingData.ConfigData.ProduceOilEfficiency == 0)
                {
                    buildingData.CurrentStoreOil = userData.CurrentStoreOil * buildingData.ConfigData.StoreOilCapacity / userData.OilMaxCapacity;
                }
            }

            List <RemovableObjectData> removableObjects = new List <RemovableObjectData>();
            foreach (RemovableObjectParameter param in paramter.RemovableObjects)
            {
                removableObjects.Add(this.GenerateRemovableData(param));
            }

            List <TaskInformation> tasks = new List <TaskInformation>();
            if (paramter.OpenedTasks != null)
            {
                foreach (OpeningTaskParameter task in paramter.OpenedTasks)
                {
                    TaskInformation taskInfo = new TaskInformation();
                    taskInfo.TaskID           = task.TaskID;
                    taskInfo.Status           = TaskStatus.Opened;
                    taskInfo.RemainingSeconds = task.RemainingSeconds;
                    if (task.ConditionProgresses != null)
                    {
                        taskInfo.ConditionProgresses = new Dictionary <int, TaskProgressInformation>();
                        foreach (ConditionProgressParameter conditionProgress in task.ConditionProgresses)
                        {
                            taskInfo.ConditionProgresses.Add(conditionProgress.ConditionID, new TaskProgressInformation()
                            {
                                StartValue = conditionProgress.StartValue
                            });
                        }
                    }
                    tasks.Add(taskInfo);
                }
            }
            if (paramter.CompletedTasks != null)
            {
                foreach (int taskID in paramter.CompletedTasks)
                {
                    TaskInformation taskInfo = new TaskInformation();
                    taskInfo.TaskID = taskID;
                    taskInfo.Status = TaskStatus.Completed;
                    tasks.Add(taskInfo);
                }
            }

            Dictionary <int, PropsData> props = new Dictionary <int, PropsData>();
            foreach (PropsParameter p in paramter.Props)
            {
                PropsData data = new PropsData();
                data.RemainingCD      = p.RemainingCD.HasValue ? p.RemainingCD.Value : 0;
                data.RemainingUseTime = p.RemainingUseTimes;
                data.PropsType        = p.PropsType;
                data.PropsConfigData  = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(p.PropsType);
                data.PropsNo          = p.PropsNo;
                data.IsInBattle       = p.IsInBattle;
                props.Add(p.PropsNo, data);
            }

            List <DefenseObjectData> defenseObjects = new List <DefenseObjectData>();
            foreach (DefenseObjectParameter d in paramter.DefenseObjects)
            {
                DefenseObjectData data = new DefenseObjectData();
                data.Position        = new TilePosition(d.PoistionColumn, d.PositionRow);
                data.DefenseObjectID = d.DefenseObjectID;
                data.Name            = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(d.RelatedProps).Name;
                data.ConfigData      = new DefenseObjectConfigWrapper(ConfigInterface.Instance.PropsConfigHelper.GetPropsData(d.RelatedProps).FunctionConfigData);
                defenseObjects.Add(data);
            }

            List <AchievementBuildingData> achievementBuildings = new List <AchievementBuildingData>();
            foreach (AchievementBuildingParameter a in paramter.AchievementBuildings)
            {
                AchievementBuildingData data = new AchievementBuildingData();
                data.AchievementBuildingType = a.AchievementBuildingType;
                data.BuildingNo       = a.AchievementBuildingNo;
                data.BuildingPosition = new TilePosition(a.PositionColumn, a.PositionRow);
                data.Life             = a.Life;
                data.ConfigData       = ConfigInterface.Instance.AchievementBuildingConfigHelper.GetAchievementBuildingData(a.AchievementBuildingType);
                achievementBuildings.Add(data);
            }

            LogicController.Instance.Initialize(userData, buildings, armies, items, armyUpgrades, itemUpgrades, removableObjects, tasks, mercenaries, props, defenseObjects,
                                                paramter.RemovableObjectStartNo, paramter.PropsStartNo, achievementBuildings, paramter.AchievementBuildingStartNo);
            LogicTimer.Instance.InitialTimer(paramter.ServerTick);
            this.m_IsUserLogined = true;
        }
    }
Example #8
0
 public Reinforcement(PropsData _pdata)
 {
     pData = _pdata;
 }
Example #9
0
    public void InitialWithResponseData(FriendResponseParameter parameter, string friendName)
    {
        UserData userData = new UserData();

        userData.Name             = friendName;
        userData.Honour           = parameter.Honour;
        userData.Level            = parameter.Level;
        userData.CurrentStoreGold = parameter.PlayerGold;
        userData.CurrentStoreFood = parameter.PlayerFood;
        userData.CurrentStoreOil  = parameter.PlayerOil;
        userData.ConfigData       = ConfigInterface.Instance.PlayerConfigHelper.GetPlayerData(parameter.Level);

        this.m_FriendData           = new PlayerLogicData(userData);
        this.m_LogicObjects         = new Dictionary <BuildingType, Dictionary <int, BuildingLogicObject> >();
        this.m_ArmyObjects          = new Dictionary <ArmyType, Dictionary <int, FriendArmyParameter> >();
        this.m_Mercenaries          = new Dictionary <MercenaryType, int>();
        this.m_ItemObjects          = new Dictionary <ItemType, Dictionary <int, FriendItemParameter> >();
        this.m_AchievementBuildings = new Dictionary <int, AchievementBuildingLogicData>();
        this.m_Buffs           = new List <BuffLogicData>();
        this.m_Props           = new List <PropsLogicData>();
        this.m_ResourceManager = new ResourceManager();

        this.m_ArmyLevels = new Dictionary <ArmyType, int>();

        Dictionary <BuildingType, Dictionary <int, BuildingData> > datas =
            new Dictionary <BuildingType, Dictionary <int, BuildingData> >();

        this.m_RemovableObjects = new Dictionary <long, RemovableObjectLogicData>();

        int objectID = 0;

        foreach (FriendObjectParameter param in parameter.Objects)
        {
            RemovableObjectData data = new RemovableObjectData();
            data.BuilderBuildingNO = param.BuilderBuildingNO;
            data.Position          = new TilePosition(param.PositionColumn, param.PositionRow);

            if (param.IsRemoving)
            {
                if (param.BuilderBuildingNO.HasValue)
                {
                    data.RemainingWorkload = 0;
                }
                else
                {
                    data.RemainingWorkload = 1;
                }
            }
            data.RemovableObjectNo   = objectID;
            data.RemovableObjectType = param.ObjectType;
            data.ConfigData          = ConfigInterface.Instance.RemovableConfigHelper.GetRemovableObjectData(param.ObjectType);
            this.m_RemovableObjects.Add(objectID, new RemovableObjectLogicData(data));
            objectID++;
        }

        int buildingNo = 0;

        foreach (FriendAchievementBuildingParameter param in parameter.AchievementBuildings)
        {
            AchievementBuildingData data = new AchievementBuildingData();
            data.AchievementBuildingType = param.AchievementBuildingType;
            data.BuildingNo       = buildingNo++;
            data.BuildingPosition = new TilePosition(param.PositionColumn, param.PositionRow);
            data.Life             = param.Life;
            data.ConfigData       = ConfigInterface.Instance.AchievementBuildingConfigHelper.GetAchievementBuildingData(param.AchievementBuildingType);
            this.m_AchievementBuildings.Add(data.BuildingNo, new AchievementBuildingLogicData(data));
        }

        foreach (FriendBuffParameter buff in parameter.Buffs)
        {
            BuffData b = new BuffData();
            b.RelatedPropsType = buff.PropsType;
            b.RemainingCD      = 10;
            b.BuffConfigData   = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(buff.PropsType).FunctionConfigData as PropsBuffConfigData;
            BuffLogicData data = new BuffLogicData(b);

            this.m_Buffs.Add(data);
        }

        int tempPropsID = 0;

        foreach (FriendPropsParameter props in parameter.Props)
        {
            PropsData       p = new PropsData();
            PropsConfigData propsConfigData = ConfigInterface.Instance.PropsConfigHelper.GetPropsData(props.PropsType);
            p.PropsConfigData  = propsConfigData;
            p.PropsNo          = tempPropsID++;
            p.PropsType        = props.PropsType;
            p.RemainingCD      = 10;
            p.RemainingUseTime = propsConfigData.MaxUseTimes;
            PropsLogicData data = new PropsLogicData(p);

            this.m_Props.Add(data);
        }

        foreach (FriendBuildingParameter param in parameter.Buildings)
        {
            BuildingConfigData configData = ConfigInterface.Instance.BuildingConfigHelper.GetBuildingData(param.BuildingTypeID, param.Level);

            BuildingData data = new BuildingData();
            data.BuilderBuildingNO = param.BuilderBuildingNO;
            data.BuildingID        = new BuildingIdentity(param.BuildingTypeID, param.BuildingNO);
            data.BuildingPosition  = new TilePosition(param.PositionColumn, param.PositionRow);
            data.Level             = param.Level;
            if (param.IsUpgrading)
            {
                if (param.BuilderBuildingNO.HasValue)
                {
                    data.UpgradeRemainingWorkload = 1;
                }
                else
                {
                    data.UpgradeRemainingWorkload = 0;
                }
            }
            if (param.IsResourceAccelerate)
            {
                data.RemainResourceAccelerateTime = 1;
            }
            if (param.IsArmyAccelerate)
            {
                data.RemainArmyAccelerateTime = 1;
            }
            if (param.IsItemAccelerate)
            {
                data.RemainItemAccelerateTime = 1;
            }

            data.ConfigData = configData;

            if (param.CurrentStoreGold.HasValue)
            {
                data.CurrentStoreGold = param.CurrentStoreGold.Value;
            }
            else if (configData.CanStoreGold)
            {
                this.m_ResourceManager.AddStorage(ResourceType.Gold, data.BuildingID, configData.StoreGoldCapacity);
            }
            if (param.CurrentStoreFood.HasValue)
            {
                data.CurrentStoreFood = param.CurrentStoreFood.Value;
            }
            else if (configData.CanStoreFood)
            {
                this.m_ResourceManager.AddStorage(ResourceType.Food, data.BuildingID, configData.StoreFoodCapacity);
            }
            if (param.CurrentStoreOil.HasValue)
            {
                data.CurrentStoreOil = param.CurrentStoreOil.Value;
            }
            else if (configData.CanStoreOil)
            {
                this.m_ResourceManager.AddStorage(ResourceType.Oil, data.BuildingID, configData.StoreOilCapacity);
            }

            if (!this.m_LogicObjects.ContainsKey(param.BuildingTypeID))
            {
                this.m_LogicObjects.Add(param.BuildingTypeID, new Dictionary <int, BuildingLogicObject>());
            }
            if (!datas.ContainsKey(param.BuildingTypeID))
            {
                datas.Add(param.BuildingTypeID, new Dictionary <int, BuildingData>());
            }
            this.m_LogicObjects[param.BuildingTypeID].Add(param.BuildingNO,
                                                          new BuildingLogicObject(data, (int)BuildingFunction.ProduceResource, false));
            datas[param.BuildingTypeID].Add(param.BuildingNO, data);

            data.AvailableMercenary = new List <MercenaryIdentity>();
            if (param.Mercenaries != null)
            {
                foreach (KeyValuePair <MercenaryType, int> mercenary in param.Mercenaries)
                {
                    MercenaryConfigData mercenaryConfigData = ConfigInterface.Instance.MercenaryConfigHelper.GetMercenaryData(mercenary.Key);
                    this.m_AlreadyArmyCapacity += mercenaryConfigData.CapcityCost * mercenary.Value;

                    for (int i = 0; i < mercenary.Value; i++)
                    {
                        data.AvailableMercenary.Add(new MercenaryIdentity(mercenary.Key, i));
                        if (!this.m_Mercenaries.ContainsKey(mercenary.Key))
                        {
                            this.m_Mercenaries.Add(mercenary.Key, 0);
                        }
                        this.m_Mercenaries[mercenary.Key]++;
                    }
                }
            }

            data.AvailableArmy = new List <ArmyIdentity>();
            if (param.Armies != null)
            {
                foreach (FriendArmyParameter army in param.Armies)
                {
                    if (!this.m_ArmyLevels.ContainsKey(army.ArmyType))
                    {
                        this.m_ArmyLevels.Add(army.ArmyType, army.ArmyLevel);
                    }

                    ArmyType       type           = army.ArmyType;
                    ArmyConfigData armyConfigData = ConfigInterface.Instance.ArmyConfigHelper.GetArmyData(army.ArmyType, army.ArmyLevel);
                    this.m_AlreadyArmyCapacity += armyConfigData.CapcityCost;
                    if (!this.m_ArmyObjects.ContainsKey(type))
                    {
                        this.m_ArmyObjects.Add(type, new Dictionary <int, FriendArmyParameter>());
                    }
                    ArmyIdentity armyID = new ArmyIdentity(type, this.m_ArmyObjects[type].Count);
                    data.AvailableArmy.Add(armyID);
                    this.m_ArmyObjects[type].Add(armyID.armyNO, army);
                }
            }
            data.AvailableItem = new List <ItemIdentity>();
            if (param.Items != null)
            {
                foreach (FriendItemParameter item in param.Items)
                {
                    ItemType type = item.ItemType;
                    if (!this.m_ItemObjects.ContainsKey(type))
                    {
                        this.m_ItemObjects.Add(type, new Dictionary <int, FriendItemParameter>());
                    }
                    ItemIdentity itemID = new ItemIdentity(type, this.m_ItemObjects[type].Count);
                    data.AvailableItem.Add(itemID);
                    this.m_ItemObjects[type].Add(itemID.itemNO, item);
                }
            }

            this.m_TotalCampCapacity += configData.ArmyCapacity;
        }

        Dictionary <ResourceType, Dictionary <BuildingIdentity, int> > result = this.m_ResourceManager.CalculateStorage
                                                                                    (userData.CurrentStoreGold, userData.CurrentStoreFood, userData.CurrentStoreOil);

        foreach (KeyValuePair <ResourceType, Dictionary <BuildingIdentity, int> > resource in result)
        {
            foreach (KeyValuePair <BuildingIdentity, int> r in resource.Value)
            {
                switch (resource.Key)
                {
                case ResourceType.Gold:
                {
                    datas[r.Key.buildingType][r.Key.buildingNO].CurrentStoreGold = r.Value;
                }
                break;

                case ResourceType.Food:
                {
                    datas[r.Key.buildingType][r.Key.buildingNO].CurrentStoreFood = r.Value;
                }
                break;

                case ResourceType.Oil:
                {
                    datas[r.Key.buildingType][r.Key.buildingNO].CurrentStoreOil = r.Value;
                }
                break;
                }
            }
        }
    }
Example #10
0
 public PropsLogicData(PropsData data)
 {
     this.m_Data = data;
 }
Example #11
0
 private void OnDestroy()
 {
     pData = null;
 }