コード例 #1
0
ファイル: TechnologyGroup.cs プロジェクト: EpicProj/RPG
        public bool InitGroup(int index)
        {
            groupIndex = index;
            var config = TechnologyModule.Instance.GetTechGroupConfig(index);
            if (config != null)
            {
                for(int i = 0; i < config.ObjectNum; i++)
                {
                    var element = config.techElementList[i];
                    GameObject obj = ObjectManager.Instance.InstantiateObject(GetElementTypePrefabPath(element));
                    obj.name = "TechObject" + element.Index.ToString();
                    ///Set Pos
                    Vector3 newPos = new Vector3(element.posX, element.posY,0);
                    obj.transform.SetParent(transform, false);
                    var rect = obj.transform.SafeGetComponent<RectTransform>().anchoredPosition = newPos;

                    TechObjectElement objEle = obj.transform.SafeGetComponent<TechObjectElement>();
                    if (objEle != null)
                    {
                        _techObjList.Add(objEle);
                        TechnologyDataModel model = new TechnologyDataModel();
                        if (!model.Create(element.TechID))
                        {
                            return false;
                        }
                        objEle.SetUpTech(model);
                    }
                }
            }
            return true;
        }
コード例 #2
0
ファイル: TechRequireElement.cs プロジェクト: EpicProj/RPG
        public void SetUpElement(RequireType type, object[] param, bool showWarning)
        {
            this.type = type;
            if (type == RequireType.Material)
            {
                int materialID            = (int)param[0];
                int count                 = (int)param[1];
                MaterialDataModel maModel = new MaterialDataModel();
                if (maModel.Create(materialID))
                {
                    _model = maModel;
                    SetElementInfo(maModel.Icon, maModel.Name + " X" + count, maModel.Rarity.color);
                    ShowLockWaring(showWarning);
                }
            }
            else if (type == RequireType.PreTech)
            {
                int techID = (int)param[0];
                TechnologyDataModel techModel = new TechnologyDataModel();
                if (techModel.Create(techID))
                {
                    _model = techModel;
                    SetElementInfo(techModel.Icon, techModel.Name, techModel.Rarity.color);
                    ShowLockWaring(showWarning);
                }
            }
            else if (type == RequireType.ResearchPoint)
            {
                ushort count          = (ushort)param[0];
                var    techPointImage = Utility.LoadSprite("SpriteOutput/UI/Main/Technology/TechPage_PointCost_Icon");
                string text           = MultiLanguage.Instance.GetTextValue(Research_Require_TechPoint_Text) + ":" + count.ToString();
                SetElementInfo(techPointImage, text, Color.white);
                ShowLockWaring(showWarning);
            }

            if (anim != null)
            {
                anim.Play();
            }
        }
コード例 #3
0
ファイル: TechnologyInfo.cs プロジェクト: EpicProj/RPG
        public TechnologyInfo(int techID)
        {
            _model = new TechnologyDataModel();
            if (!_model.Create(techID))
            {
                return;
            }
            this.techID = techID;
            baseType    = TechnologyModule.GetTechBaseType(techID);

            techRequireList      = TechnologyModule.Instance.GetTechRequireList(techID);
            techFinishEffectList = TechnologyModule.Instance.GetTechCompleteEffect(techID);

            if (TechnologyModule.GetTechDataByID(techID).Unlock)
            {
                currentState = TechnologyState.Unlock;
            }
            else
            {
                currentState = TechnologyState.Lock;
            }
        }