private ColorBlock colorBuff; //用来存储本来的颜色 public void SetMission(MissionBasic In, Text missionText) { if (!missionNametext) { missionNametext = this.GetComponentInChildren <Text> (); } if (!theMissionButton) { theMissionButton = this.GetComponentInChildren <Button> (); } theMission = In; missionNametext.text = theMission.missionName; missionInformationText = missionText; missionID = 1; if (In is MainMissionBasic) { ColorBlock mainMissionColor = new ColorBlock(); mainMissionColor.normalColor = Color.magenta; mainMissionColor.highlightedColor = Color.magenta; mainMissionColor.pressedColor = Color.gray; mainMissionColor.colorMultiplier = 1f; theMissionButton.colors = mainMissionColor; missionID = 0; } colorBuff = theMissionButton.colors; }
private void makeMission(DialogFrame use) { string[] missionNames = use.information.Split(','); for (int i = 0; i < missionNames.Length; i++) { System.Reflection.Assembly AS = System.Reflection.Assembly.GetExecutingAssembly(); MissionBasic theMission = AS.CreateInstance(missionNames[i]) as MissionBasic; SystemValues.thePlayer.GetComponent <Player> ().theMissionPackage.AddNewMission(theMission); } }
private MissionBasic theMainMission = null; //这个任务全局唯一的主线任务 public void AddNewMission(MissionBasic theMission) { //添加任务到背包 //主线任务只会有一个的 theMissions.RemoveAll(X => X == null); MissionBasic missionHave = theMissions.Find(X => X.GetType().Equals(theMission.GetType())); if (missionHave != null) { //这个任务可以更新 //主线任务都是可以更新的,一些boss战的任务是靠更新完结的 if (missionHave.CanUpdate()) { missionHave.OnMissionUpdate(); //print ("update mission"); } else { //如果这个任务可以重复领取 if (missionHave.checkMissionOver()) { missionHave.OnMissionOver(); theMissions.Remove(missionHave); theMission.thePlayer = this.thePlayer; theMissions.Add(theMission); theMission.MakeStart(); } } } else { theMission.thePlayer = this.thePlayer; theMissions.Add(theMission); theMission.MakeStart(); UIController.GetInstance().ShowUI <messageBox> ("任务更新"); } }