public void UpdateModel() { if (model == null) { return; } intro_text.text = model._config.skill_des.Replace("t", "<color=#FF9A00>" + (int)model.GetHurtValue() + "</color>"); double needMoney = 0; if (!model.IsLearn()) { needMoney = model.GetLearnMoney(); level_up_button.GetComponentInChildren <Text>().text = "学习"; level_up_info_text.text = "学习需要金钱:" + ((ActorModel.Model.GetMoney() >= needMoney) ? "<color=green>" : "<color=red>") + needMoney + "</color>"; } else { needMoney = model.GetLevelUpMoney(); level_up_button.GetComponentInChildren <Text>().text = "升级"; level_up_info_text.text = DreamerUtil.GetColorRichText("\t\t等级:" + model.GetSkillLevel(), Color.white) + "\n升级所需金钱: " + ((ActorModel.Model.GetMoney() >= needMoney) ? "<color=green>" : "<color=red>") + needMoney + " </color>"; } level_up_button.interactable = ActorModel.Model.GetMoney() >= needMoney; level_up_button.GetComponentInChildren <Text>().color = ActorModel.Model.GetMoney() >= needMoney ? Color.yellow : Color.gray; }
public void UpdateReadyState(bool ready) { if (isLocal) { return; } this.isReady = ready; DreamerTool.UI.View.CurrentScene.GetView <RoomView>().CheckReady(); ready_text.text = ready ? DreamerUtil.GetColorRichText("已准备", Color.green) : DreamerUtil.GetColorRichText("未准备", Color.red); }
public void SignIn() { ActorModel.Model.SignInDate.Add(TimeModel.Instance.Now); View.CurrentScene.GetView <SignInView>().UpdateCell(); View.CurrentScene.GetView <SignInView>().isTiming = true; var money = double.Parse(ItemValueText.text.Trim('x')); ActorModel.Model.SetMoney(money); View.CurrentScene.OpenView <TipView>().SetContent("签到成功! \n获得奖励" + DreamerUtil.GetColorRichText(" 金币: x" + money, Color.yellow)); }
public void Init() { player_name_text.text = ActorModel.Model.actor_name + " (" + ActorModel.Model.knightLevel + ")"; var attrubutes = Enum.GetNames(typeof(PlayerAttribute)); for (int i = 0; i < attrubutes.Length; i++) { player_attribute_text[i].transform.GetChild(0).gameObject.SetActive(false); player_attribute_text[i].text = attrubutes[i] + ": " + DreamerUtil.GetColorRichText(ActorModel.Model.GetPlayerAttribute((PlayerAttribute)Enum.Parse(typeof(PlayerAttribute), attrubutes[i])).ToString(), Color.yellow); } }
public void LevelUp() { if (!model.IsLearn()) { View.CurrentScene.OpenView <TipView>().SetContent(DreamerUtil.GetColorRichText(model._config.skill_name, Color.yellow) + "\t学习成功!"); model.Learn(); } else { View.CurrentScene.OpenView <TipView>().SetContent(DreamerUtil.GetColorRichText(model._config.skill_name, Color.yellow) + "\t升级成功!"); } model.SetSkillLevel(1); ActorModel.Model.SetMoney(-model.GetLevelUpMoney()); EventManager.OnSkillLevelUp(model); }
IEnumerator TextAnim(Text t, double value, double end, string c) { while (value != end) { if (value > end) { value--; } else { value++; } t.text = c + DreamerUtil.GetColorRichText(value.ToString(), Color.yellow); yield return(null); } }
public void OnChallengeBtnClick() { if (ActorModel.Model.GetMoney() >= 1000) { CurrentScene.OpenView <BoxView>().SetText("你确定要进行挑战吗?\n需要支付" + DreamerUtil.GetColorRichText("1000金币", Color.yellow) + "门票费用哦", (v) => { if (v) { EndlessScene.level = levelIndex; ActorModel.Model.SetMoney(-1000); LoadingScene.LoadScene(GameConstData.ENDLESSS_SCENE_NAME); } }); } else { CurrentScene.OpenView <TipView>().SetContent("没钱来干什么,挑战一次需要1000金币!"); } }
public void UpdatePlayAttributeText(PlayerAttribute attribute, double value) { // StopAllCoroutines(); var start = ActorModel.Model.GetPlayerAttribute(attribute) - value; var coroutine = StartCoroutine(TextAnim(player_attribute_text[(int)attribute], start, ActorModel.Model.GetPlayerAttribute(attribute), attribute + ": ")); if (coroutines.ContainsKey(attribute)) { if (coroutines[attribute] != null) { StopCoroutine(coroutines[attribute]); } coroutines.Remove(attribute); } coroutines.Add(attribute, coroutine); player_attribute_text[(int)attribute].transform.GetChild(0).gameObject.SetActive(false); player_attribute_text[(int)attribute].transform.GetChild(0).gameObject.SetActive(true); player_attribute_text[(int)attribute].transform.GetChild(0).GetComponent <Text>().text = DreamerUtil.GetColorRichText("(" + (value > 0?"+":"") + value + ")", (value > 0?Color.green:Color.red)); }