private void Start() { Anim = this.gameObject.GetComponent <Animator>(); AddHireTypes(new HireType(1, 1)); SpecialEventCount = Random.Range(1, 6);//随机一段时间发生影响产品的事件 HourEvent.AddListener(GCTimePass); SGC = this; }
void HourPass() { Hour += 1; HourEvent.Invoke(); for (int i = 0; i < CurrentDeps.Count; i++) { CurrentDeps[i].Produce(); } if (Hour > 8) { //for(int i = 0; i < CurrentDeps.Count; i++) //{ // CurrentDeps[i].OneHourPass(); //} Hour = 8; FOEMoney += 30; if (FOEMoney >= FOEMoneyRequest) { FOEEvent(); } StartWorkEnd(); } //if (Day > 5) //旧的5日1周时间流 //{ // Week += 1; // Day = 1; // WeeklyEvent.Invoke(); //} //if(Week > 4) //{ // Month += 1; // Week = 1; // PrC.UserChange(); // Money = Money + Income - Salary; // MonthlyEvent.Invoke(); // for (int i = 0; i < CurrentDeps.Count; i++) // { // CurrentDeps[i].FailCheck(); // } //} //if(Month > 12) //{ // Year += 1; // Month = 1; //} //Text_Time.text = "年" + Year + " 月" + Month + " 周" + Week + " 日" + Day + " 时" + Hour; Text_Time.text = "年" + Year + " 月" + Month + " 周" + Week + " 时" + Hour; }
private void InitViews() { BackgroundContent?.SetBackgroundColor(ColorConstants.BackroundContent); EventImage?.SetImageFromUrl(EventManager.Instance.GetDetails().ImagePathView); EventImage?.SetBackgroundColor(ColorConstants.TransparentColor, 5); EventImage.Swipe -= Image_Swipe; EventImage.Swipe += Image_Swipe; if (EventName != null) { EventName.Text = EventManager.Instance.GetDetails().Name; EventName.SetFont(FontsConstant.OpenSansRegular, FontsConstant.Size28); EventName.SetTextColor(ColorConstants.WhiteColor); } if (EventDescription != null) { EventDescription.Text = EventManager.Instance.GetDetails().Description; EventDescription.SetTextColor(ColorConstants.WhiteColor); EventDescription.SetFont(FontsConstant.OpenSansRegular); } if (TimeEvent != null) { TimeEvent.Text = EventManager.Instance.GetDetails().EventDateTime.ToString("dd") + " " + EventManager.Instance.GetDetails().EventDateTime.ToString("MMMM"); HourEvent.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size14); TimeEvent.SetTextColor(ColorConstants.WhiteColor); } SeparatorImage?.SetImageFromResource(DrawableConstants.SeparatorLineEvent); if (HourEvent != null) { HourEvent.Text = EventManager.Instance.GetDetails().EventDateTime.ToString("H:mm"); HourEvent.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size15); HourEvent.SetTextColor(ColorConstants.SelectorHome); } TimeEventBackground?.SetImageFromResource(DrawableConstants.EventDateBackgroundImage); }
public void OnHourPassed() { HourEvent?.Invoke(this, new TimerEventArgs(this)); }