123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using com.workman.cm3d2.task;
- using I2.Loc;
- using PlayerStatus;
- using Schedule;
- using UnityEngine;
- public class ResultWorkCtrl : BaseCreateViewerCtrl
- {
- public Action<string> ActionToDisplayCommuBonus { get; set; }
- public void Init(ResultWorkMgr resultWorkMgr, GameObject goPanel)
- {
- this.m_mgr = resultWorkMgr;
- this.m_goPanel = goPanel;
- foreach (GameObject gameObject in this.disableObjectList)
- {
- gameObject.SetActive(false);
- }
- }
- private void InitViewer()
- {
- this.m_scrollBar = UTY.GetChildObject(this.m_goPanel, "MaidStatusViewer/BG/Scroll Bar", false).GetComponent<UIScrollBar>();
- UIButton component = UTY.GetChildObject(this.m_goPanel, "Ok", false).GetComponent<UIButton>();
- EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.m_mgr.CloseResultWorkPanel));
- this.m_unitPrefabPath = "SceneDaily/ResultWork/Prefab/MaidStatusUnit";
- this.m_goUnitParent = UTY.GetChildObject(this.m_goPanel, "MaidStatusViewer/BG/Contents/SelectedMaidUnitParent", false);
- this.m_resultWorkIconPrefab = Resources.Load<GameObject>("SceneDaily/ResultWork/Prefab/ResultWorkIcon");
- this.m_hasActiveColor = false;
- this.PlaySe(this.m_mgr.GetAudioClipName(ScheduleData.WorkSuccessLv.Success));
- Localize component2 = UTY.GetChildObject(this.m_goPanel, "MaidStatusViewer/Header/Frame_Time/Label", false).GetComponent<Localize>();
- if (this.m_mgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Daytime)
- {
- component2.SetTerm("System/昼");
- }
- else if (this.m_mgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Night)
- {
- component2.SetTerm("System/夜");
- }
- }
- public void CreateMaidStatusViewer(Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> dicMaidStatusAndTaskInfo, Dictionary<string, ResultWorkCtrl.ResultWork> dicResultWork)
- {
- if (!this.m_bInit)
- {
- this.InitViewer();
- this.m_bInit = true;
- }
- this.m_dicMaidStatusAndTask = dicMaidStatusAndTaskInfo;
- this.m_dicResultWork = dicResultWork;
- base.CreateViewerWhenDataNotExist<string, ScheduleCtrl.MaidStatusAndTaskUnit>(dicMaidStatusAndTaskInfo);
- }
- protected override void SetDataForViewer()
- {
- for (int i = 0; i < 40; i++)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null;
- GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goUnitPrefab);
- if (this.m_dicMaidStatusAndTask.TryGetValue(string.Format("slot_{0}", i), out maidStatusAndTaskUnit))
- {
- ScheduleCtrl.SetMaidStatus(UTY.GetChildObject(gameObject, "MaidStatus", false), maidStatusAndTaskUnit);
- }
- else
- {
- ScheduleCtrl.SetEmptyMaidStatusResult(gameObject);
- }
- gameObject.name = string.Format("slot_{0}", i);
- base.SetTransformInfo(gameObject);
- GameObject childObject = UTY.GetChildObject(gameObject, "MaidStatus", false);
- GameObject childObject2 = UTY.GetChildObject(childObject, "SelectCursor", false);
- childObject2.SetActive(false);
- childObject.GetComponent<UIDragDropMaidStatus>().enabled = false;
- UIButton component = childObject.GetComponent<UIButton>();
- BoxCollider component2 = childObject.GetComponent<BoxCollider>();
- component.enabled = false;
- component2.enabled = false;
- childObject.name = string.Format("slot_{0}_" + ScheduleCtrl.SlotColumn.MaidStatus, i);
- GameObject childObject3 = UTY.GetChildObject(gameObject, "Task", false);
- if (maidStatusAndTaskUnit != null)
- {
- UIButton component3 = childObject3.GetComponent<UIButton>();
- maidStatusAndTaskUnit.uiBtnDaytimeTask = component3;
- UITexture component4 = childObject3.GetComponent<UITexture>();
- component4.mainTexture = maidStatusAndTaskUnit.taskIcon;
- component3.enabled = false;
- childObject3.GetComponent<BoxCollider>().enabled = false;
- }
- GameObject childObject4 = UTY.GetChildObject(childObject3, "SelectCursor", false);
- childObject4.SetActive(false);
- GameObject childObject5 = UTY.GetChildObject(childObject3, "NamePlate", false);
- childObject5.SetActive(false);
- childObject3.name = string.Format("slot_{0}_" + ScheduleCtrl.SlotColumn.DaytimeTask, i);
- GameObject childObject6 = UTY.GetChildObject(gameObject, "Icon_MaidClassMax", false);
- childObject6.SetActive(false);
- GameObject childObject7 = UTY.GetChildObject(gameObject, "Icon_YotogiClassMax", false);
- childObject7.SetActive(false);
- if (maidStatusAndTaskUnit != null)
- {
- ResultWorkCtrl.ResultWork resultWork = null;
- if (this.m_dicResultWork.TryGetValue(maidStatusAndTaskUnit.slotNo.ToString(), out resultWork))
- {
- resultWork.goTask = childObject3;
- resultWork.goIconMaidClassMax = childObject6;
- resultWork.goIconYotogiClassMax = childObject7;
- bool flag = true;
- if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Yotogi || resultWork.workId == ScheduleCSVData.faclilityPowerUpWorkId)
- {
- flag = false;
- }
- GameObject childObject8 = UTY.GetChildObject(gameObject, "CommuNoon", false);
- if (flag)
- {
- UIToggle component5 = childObject8.GetComponent<UIToggle>();
- component5.value = resultWork.commuFlag;
- }
- else
- {
- childObject8.SetActive(false);
- }
- GameObject childObject9 = UTY.GetChildObject(gameObject, "UpParam", false);
- ScheduleMaidStatusUnit component6 = childObject9.GetComponent<ScheduleMaidStatusUnit>();
- component6.Init(this.m_mgr, i);
- this.ViewUpParam(component6, resultWork);
- this.ResultIcon(resultWork);
- }
- if (!DailyMgr.IsLegacy && maidStatusAndTaskUnit.maidStatus != null && maidStatusAndTaskUnit.maidStatus.maid != null)
- {
- GameMain.Instance.CharacterMgr.status.CheckTrophyMaidStatus(maidStatusAndTaskUnit.maidStatus.maid);
- }
- }
- }
- }
- private void ViewUpParam(ScheduleMaidStatusUnit upParamUnit, ResultWorkCtrl.ResultWork resultWork)
- {
- if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Training)
- {
- ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[resultWork.workId];
- if (training.trainingType == ScheduleCSVData.TrainingType.Trainee)
- {
- upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Trainee);
- }
- else if (training.trainingType == ScheduleCSVData.TrainingType.Trainer)
- {
- upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Trainer);
- }
- else
- {
- upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Training);
- }
- }
- else if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Yotogi)
- {
- upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Yotogi);
- }
- else if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Work)
- {
- if (resultWork.workId == ScheduleCSVData.faclilityPowerUpWorkId)
- {
- upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Facility);
- }
- else
- {
- upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Work);
- }
- }
- }
- private void DisplayResultWorkIconBySlotNo(string slotNo)
- {
- ResultWorkCtrl.ResultWork resultWork = null;
- if (this.m_dicResultWork.TryGetValue(slotNo, out resultWork))
- {
- int num = 34;
- float value = Mathf.Clamp(float.Parse(slotNo) - 5f, 0f, (float)num) / (float)num;
- this.m_scrollBar.value = value;
- this.ResultIcon(resultWork);
- this.PlaySe(resultWork.audioClipName);
- }
- }
- private void ResultIcon(ResultWorkCtrl.ResultWork resultWork)
- {
- GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_resultWorkIconPrefab);
- gameObject.GetComponent<UITexture>().mainTexture = resultWork.resultTaskIcon;
- GameObject goTask = resultWork.goTask;
- base.SetTransformInfo(goTask, gameObject);
- }
- private void PlaySe(string audioClipName)
- {
- GameMain.Instance.SoundMgr.PlaySe(audioClipName, false);
- }
- public void SetActiveViewer(ResultWorkMgr.ResultType result)
- {
- foreach (KeyValuePair<ResultWorkMgr.ResultType, GameObject> keyValuePair in this.m_dicCanNotDispSimultaneouslyViewer)
- {
- if (result == keyValuePair.Key)
- {
- keyValuePair.Value.SetActive(true);
- }
- else
- {
- keyValuePair.Value.SetActive(false);
- }
- }
- }
- public string GetMaidIdByButtonName(string buttonName)
- {
- ScheduleCtrl.Slot slotByButtonName = ScheduleCtrl.GetSlotByButtonName(buttonName);
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(slotByButtonName.slotNo, out maidStatusAndTaskUnit))
- {
- return maidStatusAndTaskUnit.maidStatus.id;
- }
- return string.Empty;
- }
- public void SetSelectedRowActive(string buttonName)
- {
- ScheduleCtrl.Slot slotByButtonName = ScheduleCtrl.GetSlotByButtonName(buttonName);
- this.SetSelectedRowActiveBySlotNo(slotByButtonName.slotNo);
- }
- public void SetSelectedRowActiveByMaidId(string maidId)
- {
- string slotNoByMaidId = this.GetSlotNoByMaidId(maidId);
- this.SetSelectedRowActiveBySlotNo(slotNoByMaidId);
- }
- public string GetSlotNoByMaidId(string maidId)
- {
- foreach (KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit> keyValuePair in this.m_dicMaidStatusAndTask)
- {
- if (keyValuePair.Value.maidStatus.id == maidId)
- {
- return keyValuePair.Key;
- }
- }
- return null;
- }
- public void SetSelectedRowActiveBySlotNo(string slotNo)
- {
- foreach (KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit> keyValuePair in this.m_dicMaidStatusAndTask)
- {
- string key = keyValuePair.Key;
- ScheduleCtrl.MaidStatusAndTaskUnit value = keyValuePair.Value;
- Color defaultColor;
- if (slotNo == key)
- {
- value.goSelectCursorMaidStatus.SetActive(true);
- defaultColor = this.activeColor;
- }
- else
- {
- value.goSelectCursorMaidStatus.SetActive(false);
- defaultColor = this.inActiveColor;
- }
- value.uiBtnMaidStatus.defaultColor = defaultColor;
- if (value.uiBtnDaytimeTask != null)
- {
- value.uiBtnDaytimeTask.defaultColor = defaultColor;
- }
- if (value.uiBtnNightTask != null)
- {
- value.uiBtnNightTask.defaultColor = defaultColor;
- }
- }
- }
- public void AdjustParameterViewer(GameObject itemParent, int displayItemCount, int heightOfTitle, UISprite targetBG)
- {
- float num = 15f;
- float num2 = 25f;
- float num3 = 0f;
- if (displayItemCount > 0)
- {
- num3 += (float)heightOfTitle + num;
- float y = itemParent.GetComponent<UITable>().padding.y;
- IEnumerator enumerator = itemParent.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- if (transform.gameObject.activeSelf)
- {
- UILabel component = transform.GetComponent<UILabel>();
- num3 += (float)component.height + y * 2f;
- }
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- num3 += num2;
- targetBG.height = (int)num3;
- }
- }
- public void StartAnimation(Action onFinished = null)
- {
- List<Task> list = new List<Task>();
- Action<string> action = new Action<string>(this.m_mgr.ClickMaidStatusByButtonName);
- Action<string> action2 = new Action<string>(this.DisplayResultWorkIconBySlotNo);
- IOrderedEnumerable<KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit>> orderedEnumerable = from pair in this.m_dicMaidStatusAndTask
- orderby pair.Value.slotNo
- select pair;
- foreach (KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit> keyValuePair in orderedEnumerable)
- {
- Task<string> item = new Task<string>(action, string.Format(keyValuePair.Key + "_" + ScheduleCtrl.SlotColumn.MaidStatus, new object[0]));
- Task<string> item2 = new Task<string>(action2, keyValuePair.Value.slotNo.ToString());
- SyncTask<string> item3 = new SyncTask<string>(new List<Task<string>>
- {
- item,
- item2
- });
- list.Add(item3);
- }
- Task<string> item4;
- if (!string.IsNullOrEmpty(this.m_mgr.SlotNoToAcquiredCommuBonus))
- {
- item4 = new Task<string>(new Action<string>(this.m_mgr.ClickMaidStatusByButtonName), "slot_" + this.m_mgr.SlotNoToAcquiredCommuBonus + "_MaidStatus");
- }
- else
- {
- string param = string.Format(this.m_dicMaidStatusAndTask.First<KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit>>().Key + "_" + ScheduleCtrl.SlotColumn.MaidStatus, new object[0]);
- item4 = new Task<string>(action, param);
- }
- list.Add(item4);
- this.GetTaskManager().listTask = list;
- this.m_taskMgr.StartTask(onFinished);
- }
- public void SetAllMaidStatusButtonEnable(bool enabled)
- {
- foreach (KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit> keyValuePair in this.m_dicMaidStatusAndTask)
- {
- keyValuePair.Value.colliderMaidStatus.enabled = enabled;
- keyValuePair.Value.uiBtnMaidStatus.enabled = enabled;
- }
- }
- public ResultWorkCtrl.ResultWork GetResultWorkBySlotNo(int slotNo)
- {
- ResultWorkCtrl.ResultWork result = null;
- if (!this.m_dicResultWork.TryGetValue(slotNo.ToString(), out result))
- {
- Debug.LogError(string.Format("不適切なスロットNoが選択されました。選択されたスロットNo={0}", slotNo));
- return null;
- }
- return result;
- }
- private TaskMgr GetTaskManager()
- {
- if (this.m_taskMgr == null)
- {
- GameObject f_goParent = GameObject.Find("/UI Root");
- GameObject childObject = UTY.GetChildObject(f_goParent, "Manager/TaskMgr", false);
- this.m_taskMgr = childObject.GetComponent<TaskMgr>();
- return this.m_taskMgr;
- }
- return this.m_taskMgr;
- }
- public void StopCoroutineIfRunning()
- {
- if (this.m_taskMgr != null)
- {
- this.m_taskMgr.Stop();
- }
- }
- public void OnFinished()
- {
- }
- public const string NOTHING = "0";
- private const int CONTENS_DISPLAYMAX = 6;
- private ResultWorkMgr m_mgr;
- private TaskMgr m_taskMgr;
- private GameObject m_goPanel;
- private GameObject m_resultWorkIconPrefab;
- private UIScrollBar m_scrollBar;
- private Dictionary<ResultWorkMgr.ResultType, GameObject> m_dicCanNotDispSimultaneouslyViewer;
- private Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> m_dicMaidStatusAndTask;
- private Dictionary<string, ResultWorkCtrl.ResultWork> m_dicResultWork;
- private Color activeColor;
- private Color inActiveColor;
- private bool m_hasActiveColor;
- private bool m_bInit;
- private const string UNIT_PARENT_PATH = "MaidStatusViewer/BG/Contents/SelectedMaidUnitParent";
- private const string UNIT_PREFAB_PATH = "SceneDaily/ResultWork/Prefab/MaidStatusUnit";
- private const string RESULT_WORK_ICON_PREFAB = "SceneDaily/ResultWork/Prefab/ResultWorkIcon";
- [SerializeField]
- private List<GameObject> disableObjectList = new List<GameObject>();
- public class ResultWork
- {
- public ScheduleTaskCtrl.TaskType taskType;
- public ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success;
- public int workId;
- public int slotNo;
- public bool hasResult;
- public string audioClipName;
- public bool commuFlag;
- public ResultWorkCtrl.UpperMaidStatus upperMaidStatus;
- public Texture2D resultTaskIcon;
- public GameObject goTask;
- public GameObject goIconMaidClassMax;
- public GameObject goIconYotogiClassMax;
- public ScheduleMaidStatusUnit upParamUnit;
- }
- public class UpperMaidStatus
- {
- public string maidId;
- public int studyRate;
- public int likability;
- public int reception;
- public int care;
- public int lovely;
- public int elegance;
- public int charm;
- public int teach;
- public int maidClassLevel;
- public int maidClassExp;
- public int cooking;
- public int vocal;
- public int dance;
- public int appealPoint;
- public bool maidLvCompletion;
- public bool givenCommuBonus;
- public bool givenPerfectSucces;
- public Texture2D bonusIcon;
- public Texture2D perfectSuccessIcon;
- public int inyoku;
- public int m_value;
- public int hentai;
- public int housi;
- public int evaluation;
- public long income;
- public int yotogiClassLevel;
- public int yotogiClassExp;
- public int yotogiPlayCount;
- public int othersPlayCount;
- public bool yotogiLvCompletion;
- public long workingFunds;
- }
- public class ResultStatus
- {
- public int slotNo;
- public ResultWorkCtrl.UpperMaidStatus maidStatus;
- }
- }
|