コード例 #1
0
        void LoadTimeEventData()
        {
            mYearEventDict.Clear();
            mTimeEventList.Clear();
            mTimeEventRangeList.Clear();

            string path    = "Data/TimeEventData";
            string content = FileHelper.ReadFileFromAsset(path);

            List <object> jsonDataArray = (List <object>)MiniJSON.Json.Deserialize(content);

            foreach (object obj in jsonDataArray)
            {
                Dictionary <string, object> recordJSON = (Dictionary <string, object>)obj;

                TimeEventData data = new TimeEventData();
                data.ParseJSONData(recordJSON);

                // Debug.Log("DEBUG: " + data.ToString());
                if (data.enable == false)
                {
                    continue;
                }

                if (data.isRange)
                {
                    AddTimeRangeEvent(data);
                }
                else
                {
                    AddTimeEvent(data);
                }
            }
        }
コード例 #2
0
        void AddTimeEvent(TimeEventData data)
        {
            int    year = data.year;
            string name = data.eventName;

            if (name == "")
            {
                return;
            }
            if (mYearEventDict.ContainsKey(year))
            {
                return;
            }
            mTimeEventList.Add(data);
            mYearEventDict.Add(year, name);
        }
コード例 #3
0
        float AddEventItemView(float posY, TimeEventData data)
        {
            GameObject newView = GameObject.Instantiate(itemViewPrefab.gameObject);

            EventItemView itemView = newView.GetComponent <EventItemView>();

            bool isUnlocked = MainGameManager.Instance.saveData.IsEventUnlocked(data.year);

            float height = isUnlocked ? itemView.unlockHeight : itemView.lockedHeight;

            height += spacing;


            itemView.SetEvent(data.eventName);
            itemView.SetYear(data.year);
            itemView.SetStatus(isUnlocked);

            RectTransform rt = newView.transform as RectTransform;

            rt.SetParent(contentView, false);
            rt.anchoredPosition = new Vector2(0, posY);

            return(posY - height);
        }
コード例 #4
0
 void AddTimeRangeEvent(TimeEventData data)
 {
     mTimeEventRangeList.Add(data);
 }