public WPDateTime AddTimeData(WPDateTime timeData) { WPDateTime newDateTime = new WPDateTime(); newDateTime.TimeData = TimeData + timeData.TimeData; return(newDateTime); }
/// <summary> /// Time UI를 content으로 업데이트합니다. /// </summary> public void TimeUIUpdate(WPDateTime content) { if (imageText_Time != null) { imageText_Time.SetText(content.ToString()); } }
private void UpdateUI(WPDateTime content) { SetText_Money("내 자금: " + WPUserDataManager.instance.Money.ToString()); SetText_Debt("빚: " + WPUserDataManager.instance.Debt.ToString()); SetText_Interest("다음달 추가될 이자: " + WPFundsManager.instance.GetInterest().ToString()); SetText_InterestRate("이자율: " + (5).ToString() + "%"); }
// 두 WPTimeData 객체가 가리키는 시간의 차이를 비교합니다. t1에 현재 시간을 가리키는 객체를 넣고, t2에 어떤 시점을 가리키는 객체를 넣으면 어떤 시점으로부터 얼마나 시간이 지났는지 그 값을 얻을 수 있습니다. public static int CompareTime(WPDateTime t1, WPDateTime t2) { if (t1 == null || t2 == null) { WPGameCommon._WPDebug("TimeData is missing"); return(-1); } return(t1.TimeData - t2.TimeData); }
private void Init() { instance = this; checkTime = WPDateTime.ParseData(WPDateTime.Now.ToData()); WPDateTime.Now.OnTimeChanged += OnTimeChanged; StartCoroutine(MainRoutine()); }
public void WeatherUIUpdate(WPDateTime content) { WPGameCommon._WPDebug("날씨 UI 변경!"); string name = System.Enum.GetName(typeof(WPEnum.Weather), WPUserDataManager.instance.Weather).Substring(1); string path = "Image/Weather/weather_" + name; SetSprite_Weather(WPResourceManager.instance.GetResource <Sprite>(path)); }
private void OnTimeChanged(WPDateTime content) { SaveTimeData(content); if (content.Week != checkTime.Week) { WPGameCommon._WPDebug("주가 바뀌었습니다!"); ChangeWeather(content); checkTime = WPDateTime.ParseData(content.ToData()); } }
public void NewsUIUpdate(WPDateTime content) { List <int> newsID = WPUserDataManager.instance.GetNewsDataByDateTime(content); ClearNews(); for (int i = 0; i < newsID.Count; ++i) { AddNews(WPGameDataManager.instance.GetData <WPData_News>(WPEnum.GameData.eNews)[newsID[i]].Description); WPGameCommon._WPDebug("뉴스 추가 : " + WPGameDataManager.instance.GetData <WPData_News>(WPEnum.GameData.eNews)[newsID[i]].Description); } WPGameCommon._WPDebug("뉴스 개수 " + newsContent.Count); }
public void OnTimeChanged(WPDateTime newTime) { TimeUIUpdate(newTime); if (checkTime.Year != newTime.Year || checkTime.Month != newTime.Month) { NewsUIUpdate(newTime); } if (newTime.Week != checkTime.Week) { WeatherUIUpdate(newTime); } checkTime = WPDateTime.ParseData(newTime.ToData()); }
public void CreateNewsList(WPDateTime currentTime) { ClearList(); List <int> newsID = WPUserDataManager.instance.GetNewsDataByDateTime(currentTime); List <WPData_News> newsData = WPGameDataManager.instance.GetData <WPData_News>(WPEnum.GameData.eNews); for (int i = 0; i < newsID.Count; ++i) { WPScrollViewItem_News newItem = Instantiate(ui_News).AddComponent <WPScrollViewItem_News>(); newItem.SetName(newsID[i].ToString()); newItem.SetText(newsData[newsID[i]].Description); AddItem(newItem); } SortItemToVertical(); }
public List <int> GetNewsDataByDateTime(WPDateTime nowTime) { if (userData == null) { return(null); } if (userData.newsData == null) { return(null); } int nowYear = nowTime.Year - WPDateTime.STANDARD_YEAR + 1; int nowMonth = nowTime.Month; WPGameCommon._WPDebug("현재 년도차 : " + nowYear + " 현재 월차 : " + nowMonth); if (userData.newsData.Count < nowYear) { for (int yearLoop = 0; yearLoop < nowYear; ++yearLoop) { if (yearLoop >= userData.newsData.Count) { userData.newsData.Insert(yearLoop, new List <List <int> >()); } for (int monthLoop = userData.newsData[yearLoop].Count; monthLoop < (yearLoop < (nowYear - 1) ? 12 : nowMonth); ++monthLoop) { WPGameCommon._WPDebug(yearLoop + "년차 " + (monthLoop + 1) + "월차 데이터 부재, 새로 생성"); userData.newsData[yearLoop].Insert(monthLoop, WPGameDataManager.instance.GetData <WPData_Event>(WPEnum.GameData.eEvent)[monthLoop].GetNewsIDByCount(3)); } } SaveData(); } if (userData.newsData[nowYear - 1].Count < nowMonth) { for (int monthLoop = userData.newsData[nowYear - 1].Count; monthLoop < nowMonth; ++monthLoop) { WPGameCommon._WPDebug((nowYear - 1) + "년차 " + (monthLoop + 1) + "월차 데이터 부재, 새로 생성"); userData.newsData[nowYear - 1].Insert(monthLoop, WPGameDataManager.instance.GetData <WPData_Event>(WPEnum.GameData.eEvent)[monthLoop].GetNewsIDByCount(3)); } SaveData(); } return(userData.newsData[nowYear - 1][nowMonth - 1]); }
///////////////////////////////////////////////////////////////////////// // Methods protected override void Init() { instance = this; this.transform.Find("Button_News").GetComponent <Button>().onClick.AddListener(OnClick_News); this.transform.Find("Button_Bank").GetComponent <Button>().onClick.AddListener(OnClick_Bank); this.transform.Find("Button_Shop").GetComponent <Button>().onClick.AddListener(OnClick_Shop); this.transform.Find("Button_Choose").GetComponent <Button>().onClick.AddListener(OnClick_Choose); newsMask = transform.Find("Mask_News"); image_Weather = transform.Find("Image_Weather").GetComponent <Image>(); imageText_Time = transform.Find("ImageText_Time").GetComponent <WPImageText>(); TimeUIUpdate(WPDateTime.Now); NewsUIUpdate(WPDateTime.Now); WeatherUIUpdate(WPDateTime.Now); checkTime = WPDateTime.ParseData(WPDateTime.Now.ToData()); WPDateTime.Now.OnTimeChanged += OnTimeChanged; StartCoroutine(NewsRoutine()); }
private void ChangeWeather(WPDateTime nowTime) { WPGameCommon._WPDebug("날씨 변경!"); int random = Random.Range(0, 100); switch (nowTime.Season) { case WPEnum.Season.eSpring: { if (random < 60) { WPUserDataManager.instance.Weather = WPEnum.Weather.eSunny; } else { WPUserDataManager.instance.Weather = WPEnum.Weather.eRain; } break; } case WPEnum.Season.eSummer: { if (random < 30) { WPUserDataManager.instance.Weather = WPEnum.Weather.eSunny; } else if (30 <= random && random < 60) { WPUserDataManager.instance.Weather = WPEnum.Weather.eDrought; } else { WPUserDataManager.instance.Weather = WPEnum.Weather.eRain; } break; } case WPEnum.Season.eAutumn: { if (random < 70) { WPUserDataManager.instance.Weather = WPEnum.Weather.eSunny; } else { WPUserDataManager.instance.Weather = WPEnum.Weather.eRain; } break; } case WPEnum.Season.eWinter: { if (random < 50) { WPUserDataManager.instance.Weather = WPEnum.Weather.eSunny; } else { WPUserDataManager.instance.Weather = WPEnum.Weather.eCold; } break; } } }
private void SaveTimeData(WPDateTime content) { //WPGameVariableManager.instance.SaveVariable(WPEnum.VariableType.eUserDate, content.ToData()); WPUserDataManager.instance.DateTime = content; }