Exemple #1
0
        public void InitBuildElement()
        {
            FunctionBlockDataModel blockModel = new FunctionBlockDataModel();

            if (_model.BuildData != null)
            {
                if (blockModel.Create(_model.BuildData.FunctionBlockID))
                {
                    Name.text        = blockModel.Name;
                    BlockIcon.sprite = blockModel.Icon;
                    TypeIcon.sprite  = blockModel.TypeIcon;
                    btn.onClick.AddListener(OnBlildElementClick);
                }
                SwitchSelectState(false);
            }
        }
Exemple #2
0
        bool InitBaseData()
        {
            if (model.ID != 0)
            {
                FunctionBlockDataModel blockModel = new FunctionBlockDataModel();
                if (blockModel.Create(model.BuildData.FunctionBlockID))
                {
                    _blockIcon.sprite = blockModel.Icon;
                    _blockName.text   = blockModel.Name;
                    _desc.text        = model.Desc;
                    _timeCost.text    = model.BuildData.TimeCost.ToString();
                    var blockData = FunctionBlockModule.GetFunctionBlockByBlockID(model.BuildData.FunctionBlockID);
                    if (blockData != null)
                    {
                        //var areaMax = FunctionBlockModule.GetFunctionBlockAreaMax(blockData);
                        //_districtMaxText.text = string.Format("{0} X {1}", areaMax.x.ToString(), areaMax.y.ToString());
                    }

                    return(true);
                }
            }
            return(false);
        }
Exemple #3
0
        /// <summary>
        /// 初始化科技完成效果
        /// </summary>
        private void SetUpTechEffect()
        {
            if (techInfo == null)
            {
                return;
            }
            ///Init
            var content = Transform.FindTransfrom("Content/Context/EffectContent/Content");

            content.InitObj(UIPath.PrefabPath.Tech_Effect_Element, Config.GlobalConfigData.TechDetail_Dialog_MaxEffect_Count);
            content.SafeSetActiveAllChild(false);

            var effectlist = techInfo.techFinishEffectList;

            int totalIndex = 0;

            for (int i = 0; i < effectlist.Count; i++)
            {
                var type = TechnologyModule.Instance.GetTechCompleteType(effectlist[i]);

                switch (type)
                {
                case TechCompleteEffect.Unlock_Block:
                    var blockList = TechnologyModule.ParseTechParam_Unlock_Block(effectlist[i].effectParam);
                    for (int j = 0; j < blockList.Count; j++)
                    {
                        FunctionBlockDataModel model = new FunctionBlockDataModel();
                        if (model.Create(blockList[j]))
                        {
                            var name    = MultiLanguage.Instance.GetTextValue(Research_Effect_Unlock_Text_Block);
                            var element = content.GetChild(totalIndex);
                            if (element != null)
                            {
                                totalIndex++;
                                var cmpt = element.transform.SafeGetComponent <TechEffectElement>();
                                cmpt.SetUpElement(model.Icon, name, model.Name, Color.white);
                                element.SafeSetActive(true);
                            }
                        }
                    }
                    break;

                case TechCompleteEffect.Unlock_Tech:
                    var techList = TechnologyModule.ParseTechParam_Unlock_Tech(effectlist[i].effectParam);
                    for (int j = 0; j < techList.Count; j++)
                    {
                        TechnologyDataModel model = new TechnologyDataModel();
                        if (model.Create(techList[j]))
                        {
                            var name    = MultiLanguage.Instance.GetTextValue(Research_Effect_Unlock_Text_Tech);
                            var element = content.GetChild(totalIndex);
                            if (element != null)
                            {
                                totalIndex++;
                                var cmpt = element.transform.SafeGetComponent <TechEffectElement>();
                                cmpt.SetUpElement(model.Icon, name, model.Name, model.Rarity.color);
                                element.SafeSetActive(true);
                            }
                        }
                    }
                    break;
                }
            }
        }