コード例 #1
0
ファイル: ExploreAreaSelectBtn.cs プロジェクト: EpicProj/RPG
        public void InitAreaItem(ExploreAreaData data)
        {
            if (data != null)
            {
                var btn = transform.SafeGetComponent <Button>();
                btn.onClick.RemoveAllListeners();
                _data = data;
                transform.FindTransfrom("Name").SafeGetComponent <Text>().text         = data.areaName;
                transform.FindTransfrom("Item/Icon").SafeGetComponent <Image>().sprite = data.areaIcon;
                _progressImage.fillAmount = data.areaTotalProgress;
                _progressText.text        = ((int)(data.areaTotalProgress * 100)).ToString() + "%";

                btn.onClick.AddListener(OnBtnClick);
            }
        }
コード例 #2
0
        /// <summary>
        /// 初始化区域任务
        /// </summary>
        private void InitExploreArea(ExploreAreaType areaType)
        {
            List <int> list = new List <int>();

            if (areaType == ExploreAreaType.earth)
            {
                list = ExploreModule.ExploreAreaListEarth;
                for (int i = 0; i < list.Count; i++)
                {
                    ExploreAreaData data = new ExploreAreaData(list[i]);
                    if (data.areaID != 0)
                    {
                        _currentExploreAreaList_Earth.Add(data);
                        ///Area Unlock
                        if (data.unlock == true)
                        {
                            data.GenerateRandomMission();
                            _currentUnlockExploreAreaList.Add(data.areaID);
                        }
                    }
                }
            }
            else if (areaType == ExploreAreaType.space)
            {
                list = ExploreModule.ExploreAreaListSpace;
                for (int i = 0; i < list.Count; i++)
                {
                    ExploreAreaData data = new ExploreAreaData(list[i]);
                    if (data.areaID != 0)
                    {
                        _currentExploreAreaList_Space.Add(data);
                        ///Area Unlock
                        if (data.unlock == true)
                        {
                            data.GenerateRandomMission();
                            _currentUnlockExploreAreaList.Add(data.areaID);
                        }
                    }
                }
            }
        }