public static void Refresh(SkillRareDegree skillRareDegree, int count) { var canvas = GameObject.Find("SubCanvasGetSkill"); var btnSkill1 = canvas.transform.Find("BtnSkill1").gameObject.GetComponent <Button>(); var btnSkill2 = canvas.transform.Find("BtnSkill2").gameObject.GetComponent <Button>(); var btnSkill3 = canvas.transform.Find("BtnSkill3").gameObject.GetComponent <Button>(); var imgDesc = canvas.transform.Find("ImgSkillDesc").gameObject.GetComponent <Image>(); if (count == 1) { btnSkill1.gameObject.SetActive(false); btnSkill3.gameObject.SetActive(false); } else { btnSkill1.gameObject.SetActive(true); btnSkill3.gameObject.SetActive(true); } var skill1 = SkillHelper.GetRandomVisibleSkill(skillRareDegree); var skill2 = SkillHelper.GetRandomVisibleSkill(skillRareDegree); var skill3 = SkillHelper.GetRandomVisibleSkill(skillRareDegree); while (skill2.Name == skill1.Name) { System.Threading.Thread.Sleep(1); skill2 = SkillHelper.GetRandomVisibleSkill(); } while (skill3.Name == skill2.Name || skill3.Name == skill1.Name) { System.Threading.Thread.Sleep(1); skill3 = SkillHelper.GetRandomVisibleSkill(); } ButtonHelper.UpdateSkillButton(btnSkill1, skill1, imgDesc, false); ButtonHelper.UpdateSkillButton(btnSkill2, skill2, imgDesc, false); ButtonHelper.UpdateSkillButton(btnSkill3, skill3, imgDesc, false); btnSkill1.onClick.RemoveAllListeners(); btnSkill1.onClick.AddListener(() => { GameInfo.GainSkill(skill1.Name); BattleCanvasSetter.SwitchBattleScene(); }); btnSkill2.onClick.RemoveAllListeners(); btnSkill2.onClick.AddListener(() => { GameInfo.GainSkill(skill2.Name); BattleCanvasSetter.SwitchBattleScene(); }); btnSkill3.onClick.RemoveAllListeners(); btnSkill3.onClick.AddListener(() => { GameInfo.GainSkill(skill3.Name); BattleCanvasSetter.SwitchBattleScene(); }); }
// Use this for initialization void Start() { Button btnSkip = GameObject.Find("SubCanvasGetSkill/BtnSkip").GetComponent <Button>(); btnSkip.onClick.AddListener(delegate() { SpoilUpdater.RemoveSkill(); BattleCanvasSetter.SwitchBattleScene(); }); }
static void RandomEventInit() { { var e = new BaseEvent(); e.Type = GameEventType.RandomEvent; e.Title = "苹果树"; e.Name = RandomEvent.苹果树; e.Description = "你遇到了一颗长满果实的苹果树"; e.Choose1Name = "采摘"; e.Choose1Desc = "回复40点生命值及10点魔法值"; e.MinStage = 1; e.MaxStage = 20; e.Sprite = SpriteHelper.GetRandomEventSprite(RandomEvent.苹果树); e.Choose1 = () => { Hero.RecoverHealth(40); Hero.RecoverMana(10); MessagePageUpdater.Update("一顿忙碌后,终于摘到了不少苹果,并饱餐一顿\n\n回复40点生命值及10点魔法值"); BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Message); BattleCanvasSetter.SwitchBattleScene(); }; e.Choose2 = e.Choose3 = null; GameInfo.EventList.Add(e); } { var e = new BaseEvent(); e.Type = GameEventType.RandomEvent; e.Title = "捕兽夹"; e.Name = RandomEvent.捕兽夹; e.Description = "前方有一个被遗弃的捕兽夹,如果不管它可能会伤害到其他的冒险者"; e.Choose1Name = "尝试拆除"; e.Choose1Desc = "这个陷阱看起来很劣质,我有把握拆除它"; e.MinStage = 1; e.MaxStage = 40; e.Sprite = SpriteHelper.GetRandomEventSprite(RandomEvent.捕兽夹); e.Choose1 = () => { var seed = NumberHelper.GetRandom(0, 3); if (seed == 2) { Hero.RecoverHealth(-30); MessagePageUpdater.Update("一阵忙碌后,不仅没有拆除陷阱,自己还被划伤了\n\n损失30点生命值"); } else { Hero.PhysicalArmor += 5; Hero.MagicArmor += 5; MessagePageUpdater.Update("成功的拆除了陷阱,提升了自身的战斗抗性\n\n增加5点物理防御力与法术防御力"); } BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Message); BattleCanvasSetter.SwitchBattleScene(); }; e.Choose2 = e.Choose3 = null; GameInfo.EventList.Add(e); } { var e = new BaseEvent(); e.Type = GameEventType.RandomEvent; e.Title = "游荡学者"; e.Name = RandomEvent.游荡学者; e.Description = "你碰到了一个满脸书生气的"; e.Choose1Name = "请教"; e.Choose1Desc = "活到老学到老,向前辈请教"; e.Choose2Name = "抢劫"; e.Choose2Desc = "柿子要挑软的捏,看看这人身上有什么宝贝"; e.MinStage = 1; e.MaxStage = 40; e.Sprite = SpriteHelper.GetRandomEventSprite(RandomEvent.游荡学者); e.Choose1 = () => { var skillName = SkillHelper.UpgradeRandomSkill(); if (string.IsNullOrEmpty(skillName)) { MessagePageUpdater.Update("学者对你说,你已经足够强大了,我没有什么能够教你的"); } else { MessagePageUpdater.Update("虚心请教后,你确实感觉学到了不少东西\n\n" + skillName + "提升一级"); } BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Message); BattleCanvasSetter.SwitchBattleScene(); }; e.Choose2 = () => { var seed = NumberHelper.GetRandom(0, 3); if (seed == 2) { MessagePageUpdater.Update("没想到看似柔弱的书生是个高手,被揍的遍体鳞伤\n\n损失40%当前生命值"); Hero.RecoverHealth(Hero.Health * -0.4f); } else { MessagePageUpdater.Update("书生主动求饶,并交出了他的所有财产\n\n获得150金币"); GameInfo.Money += 150; BattleUpdater.UpdateStageInfo(); } BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Message); BattleCanvasSetter.SwitchBattleScene(); }; e.Choose3 = null; GameInfo.EventList.Add(e); } }
/// <summary> /// 刷新商店 /// </summary> public static void Refresh() { var btnProp = GameObject.Find("SubCanvasShop/BtnProp").GetComponent <Button>(); //var btnUpgrade = GameObject.Find("SubCanvasShop/BtnUpgrade").GetComponent<Button>(); var btnSkill1 = GameObject.Find("SubCanvasShop/BtnSkill1").GetComponent <Button>(); var btnSkill2 = GameObject.Find("SubCanvasShop/BtnSkill2").GetComponent <Button>(); var btnSkill3 = GameObject.Find("SubCanvasShop/BtnSkill3").GetComponent <Button>(); var imgSkill1 = GameObject.Find("SubCanvasShop/BtnSkill1/Image").GetComponent <Image>(); var imgSkill2 = GameObject.Find("SubCanvasShop/BtnSkill2/Image").GetComponent <Image>(); var imgSkill3 = GameObject.Find("SubCanvasShop/BtnSkill3/Image").GetComponent <Image>(); var txtNameSkill1 = GameObject.Find("SubCanvasShop/BtnSkill1/TxtName").GetComponent <Text>(); var txtNameSkill2 = GameObject.Find("SubCanvasShop/BtnSkill2/TxtName").GetComponent <Text>(); var txtNameSkill3 = GameObject.Find("SubCanvasShop/BtnSkill3/TxtName").GetComponent <Text>(); var txtDescSkill1 = GameObject.Find("SubCanvasShop/BtnSkill1/TxtDes").GetComponent <Text>(); var txtDescSkill2 = GameObject.Find("SubCanvasShop/BtnSkill2/TxtDes").GetComponent <Text>(); var txtDescSkill3 = GameObject.Find("SubCanvasShop/BtnSkill3/TxtDes").GetComponent <Text>(); var txtCostSkill1 = GameObject.Find("SubCanvasShop/BtnSkill1/TxtCost").GetComponent <Text>(); var txtCostSkill2 = GameObject.Find("SubCanvasShop/BtnSkill2/TxtCost").GetComponent <Text>(); var txtCostSkill3 = GameObject.Find("SubCanvasShop/BtnSkill3/TxtCost").GetComponent <Text>(); var txtPrice1 = GameObject.Find("SubCanvasShop/BtnPrice1/TxtPrice").GetComponent <Text>(); var txtPrice2 = GameObject.Find("SubCanvasShop/BtnPrice2/TxtPrice").GetComponent <Text>(); var txtPrice3 = GameObject.Find("SubCanvasShop/BtnPrice3/TxtPrice").GetComponent <Text>(); var txtPrice4 = GameObject.Find("SubCanvasShop/BtnPrice4/TxtPrice").GetComponent <Text>(); var txtPrice5 = GameObject.Find("SubCanvasShop/BtnPrice5/TxtPrice").GetComponent <Text>(); var btnPrice1 = GameObject.Find("SubCanvasShop/BtnPrice1").GetComponent <Button>(); var btnPrice2 = GameObject.Find("SubCanvasShop/BtnPrice2").GetComponent <Button>(); var btnPrice3 = GameObject.Find("SubCanvasShop/BtnPrice3").GetComponent <Button>(); var btnPrice4 = GameObject.Find("SubCanvasShop/BtnPrice4").GetComponent <Button>(); var btnPrice5 = GameObject.Find("SubCanvasShop/BtnPrice5").GetComponent <Button>(); var canvas = GameObject.Find("SubCanvasShop"); var ratio = Convert.ToSingle(100 + NumberHelper.GetRandom(-10, 11)) / 100f; #region 隐藏两个信息面板 canvas.transform.Find("TxtDesc").gameObject.SetActive(false); canvas.transform.Find("ImgSkillDesc").gameObject.SetActive(false); #endregion #region 刷新宝物 //随机刷新一个未获得的普通宝物 { var randomProp = PropHelper.GetRandomVisibleProp(PropType.Normal); txtPrice1.text = Math.Round((randomProp.Price * ratio)).ToString(); btnProp.image.sprite = SpriteHelper.GetPropSprite(randomProp.Name); EventTrigger trigger = btnProp.gameObject.GetComponent <EventTrigger>(); if (trigger == null) { trigger = btnProp.gameObject.AddComponent <EventTrigger>(); } trigger.triggers.Clear(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; entry.callback = new EventTrigger.TriggerEvent(); entry.callback.AddListener((eventdata) => { canvas.transform.Find("TxtDesc").gameObject.SetActive(true); canvas.transform.Find("ImgSkillDesc").gameObject.SetActive(false); GameObject.Find("SubCanvasShop/TxtDesc").GetComponent <Text>().text = randomProp.Description; }); trigger.triggers.Add(entry); if (GameInfo.Money < randomProp.Price) { btnPrice1.interactable = false; } else { btnPrice1.interactable = true; //绑定宝物购买事件 btnPrice1.onClick.RemoveAllListeners(); btnPrice1.onClick.AddListener(() => { GameInfo.Money -= Convert.ToInt32(Math.Round((randomProp.Price * ratio))); GameInfo.GainProp(randomProp.Name); BattleUpdater.UpdateStageInfo(); BattleUpdater.UpdateMessage("获得宝物:" + randomProp.DisplayName); GameInfo.NewStage(); }); } } #endregion #region 升级技能 if (GameInfo.Money < 100) { btnPrice2.interactable = false; } else { btnPrice2.interactable = true; btnPrice2.onClick.RemoveAllListeners(); btnPrice2.onClick.AddListener(() => { GameInfo.Money -= 100; BattleUpdater.UpdateStageInfo(); UpgradeSkillUpdater.ReFresh(); BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.UpgradeSkill); BattleCanvasSetter.SwitchBattleScene(); }); } #endregion #region 刷新技能 //生成三个不同的技能 var skill1 = SkillHelper.GetRandomVisibleSkill(); var skill2 = SkillHelper.GetRandomVisibleSkill(); var skill3 = SkillHelper.GetRandomVisibleSkill(); while (skill2.Name == skill1.Name) { System.Threading.Thread.Sleep(1); skill2 = SkillHelper.GetRandomVisibleSkill(); } while (skill3.Name == skill2.Name || skill3.Name == skill1.Name) { System.Threading.Thread.Sleep(1); skill3 = SkillHelper.GetRandomVisibleSkill(); } { var price1 = Math.Round(skill1.Price * ratio); btnSkill1.image.color = ColorHelper.GetSkillFrameColor(skill1.Type); imgSkill1.sprite = SpriteHelper.GetSkillIcon(skill1.Name); txtDescSkill1.text = SkillHelper.GetSkillDesc(skill1); txtNameSkill1.text = skill1.DisplayName; txtCostSkill1.text = skill1.Cost.ToString(); //如果技能消耗为0 if (skill1.Cost == 0) { txtCostSkill1.color = ColorHelper.GetCostColor(true); } else { txtCostSkill1.color = ColorHelper.GetCostColor(false); } EventTrigger trigger = btnSkill1.gameObject.GetComponent <EventTrigger>(); if (trigger == null) { trigger = btnSkill1.gameObject.AddComponent <EventTrigger>(); } trigger.triggers.Clear(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; entry.callback = new EventTrigger.TriggerEvent(); entry.callback.AddListener((eventdata) => { canvas.transform.Find("TxtDesc").gameObject.SetActive(false); canvas.transform.Find("ImgSkillDesc").gameObject.SetActive(true); GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar1").GetComponent <Text>().text = skill1.DescriptionLevel1; GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar2").GetComponent <Text>().text = skill1.DescriptionLevel2; GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar3").GetComponent <Text>().text = skill1.DescriptionLevel3; }); trigger.triggers.Add(entry); txtPrice3.text = price1.ToString(); if (GameInfo.Money < price1) { btnPrice3.interactable = false; } else { btnPrice3.interactable = true; btnPrice3.onClick.RemoveAllListeners(); btnPrice3.onClick.AddListener(() => { GameInfo.Money -= Convert.ToInt32(price1); BattleUpdater.UpdateStageInfo(); GameInfo.GainSkill(skill1.Name); GameInfo.NewStage(); }); } } { var price2 = Math.Round(skill2.Price * ratio); btnSkill2.image.color = ColorHelper.GetSkillFrameColor(skill2.Type); imgSkill2.sprite = SpriteHelper.GetSkillIcon(skill2.Name); txtDescSkill2.text = SkillHelper.GetSkillDesc(skill2); txtNameSkill2.text = skill2.DisplayName; txtCostSkill2.text = skill2.Cost.ToString(); //如果技能消耗为0 if (skill2.Cost == 0) { txtCostSkill2.color = ColorHelper.GetCostColor(true); } else { txtCostSkill2.color = ColorHelper.GetCostColor(false); } EventTrigger trigger = btnSkill2.gameObject.GetComponent <EventTrigger>(); if (trigger == null) { trigger = btnSkill2.gameObject.AddComponent <EventTrigger>(); } trigger.triggers.Clear(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; entry.callback = new EventTrigger.TriggerEvent(); entry.callback.AddListener((eventdata) => { canvas.transform.Find("TxtDesc").gameObject.SetActive(false); canvas.transform.Find("ImgSkillDesc").gameObject.SetActive(true); GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar1").GetComponent <Text>().text = skill2.DescriptionLevel1; GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar2").GetComponent <Text>().text = skill2.DescriptionLevel2; GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar3").GetComponent <Text>().text = skill2.DescriptionLevel3; }); trigger.triggers.Add(entry); txtPrice4.text = price2.ToString(); if (GameInfo.Money < price2) { btnPrice4.interactable = false; } else { btnPrice4.interactable = true; btnPrice4.onClick.RemoveAllListeners(); btnPrice4.onClick.AddListener(() => { GameInfo.Money -= Convert.ToInt32(price2); BattleUpdater.UpdateStageInfo(); GameInfo.GainSkill(skill2.Name); GameInfo.NewStage(); }); } } { var price3 = Math.Round(skill3.Price * ratio); btnSkill3.image.color = ColorHelper.GetSkillFrameColor(skill3.Type); imgSkill3.sprite = SpriteHelper.GetSkillIcon(skill3.Name); txtDescSkill3.text = SkillHelper.GetSkillDesc(skill3); txtNameSkill3.text = skill3.DisplayName; txtCostSkill3.text = skill3.Cost.ToString(); //如果技能消耗为0 if (skill3.Cost == 0) { txtCostSkill3.color = ColorHelper.GetCostColor(true); } else { txtCostSkill3.color = ColorHelper.GetCostColor(false); } EventTrigger trigger = btnSkill3.gameObject.GetComponent <EventTrigger>(); if (trigger == null) { trigger = btnSkill3.gameObject.AddComponent <EventTrigger>(); } trigger.triggers.Clear(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; entry.callback = new EventTrigger.TriggerEvent(); entry.callback.AddListener((eventdata) => { canvas.transform.Find("TxtDesc").gameObject.SetActive(false); canvas.transform.Find("ImgSkillDesc").gameObject.SetActive(true); GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar1").GetComponent <Text>().text = skill3.DescriptionLevel1; GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar2").GetComponent <Text>().text = skill3.DescriptionLevel2; GameObject.Find("SubCanvasShop/ImgSkillDesc/TxtStar3").GetComponent <Text>().text = skill3.DescriptionLevel3; }); trigger.triggers.Add(entry); txtPrice5.text = price3.ToString(); if (GameInfo.Money < price3) { btnPrice5.interactable = false; } else { btnPrice5.interactable = true; btnPrice5.onClick.RemoveAllListeners(); btnPrice5.onClick.AddListener(() => { GameInfo.Money -= Convert.ToInt32(price3); BattleUpdater.UpdateStageInfo(); GameInfo.GainSkill(skill3.Name); GameInfo.NewStage(); }); } } #endregion }
void InitButtonEvents() { Text txtDesc = GameObject.Find("CanvasChooseHero/TextDesc").GetComponent <Text>(); Text txtName = GameObject.Find("CanvasChooseHero/TextName").GetComponent <Text>(); btnWarrior = GameObject.Find("CanvasChooseHero/BtnWarrior").GetComponent <Button>(); btnMage = GameObject.Find("CanvasChooseHero/BtnMage").GetComponent <Button>(); btnDefault = GameObject.Find("CanvasChooseHero/BtnDefault").GetComponent <Button>(); GameInfo.Role = HeroRole.FearlessWarrior; #region 择战士 btnWarrior.onClick.AddListener(delegate() { GameInfo.Role = HeroRole.FearlessWarrior; txtDesc.text = "拥有强大的物理伤害能力与爆发能力\n也可以通过转职提升自身的防御能力"; txtName.text = "无畏战神"; txtName.color = ColorHelper.GetU3dColor(255, 0, 0); ResetBtnColor(); btnWarrior.image.color = ColorHelper.GetU3dColor(36, 203, 140); //btnWarrior.image.color = Color.red; }); #endregion #region 择法师 btnMage.onClick.AddListener(delegate() { GameInfo.Role = HeroRole.ElementalMage; txtDesc.text = "拥有强大的法术伤害能力与控制能力\n也可以通过转职提升自身的持续作战能力"; txtName.text = "元素法师"; txtName.color = ColorHelper.GetU3dColor(106, 68, 186); ResetBtnColor(); btnMage.image.color = ColorHelper.GetU3dColor(36, 203, 140); }); #endregion #region 择默认 btnDefault.onClick.AddListener(delegate() { GameInfo.Role = HeroRole.Default; txtDesc.text = ""; txtName.text = "正在研发中的角色!"; txtName.color = ColorHelper.GetU3dColor(0, 0, 0); ResetBtnColor(); btnDefault.image.color = ColorHelper.GetU3dColor(36, 203, 140); }); #endregion #region 出发 Button btnConfirm = GameObject.Find("CanvasChooseHero/BtnConfirm").GetComponent <Button>(); btnConfirm.onClick.AddListener(delegate() { if (GameInfo.Role == HeroRole.Default) { return; } BattleCanvasSetter.Init(); GameInfo.CurrentScene = SceneType.BattleMain; CameraSetter.SwichScene(GameInfo.CurrentScene); //开始一场新的对局 GameInfo.NewGame(); }); #endregion #region 返回菜单 Button btnReturn = GameObject.Find("CanvasChooseHero/BtnReturn").GetComponent <Button>(); btnReturn.onClick.AddListener(ReturnToMenu); #endregion }
/// <summary> /// 更改战利品界面UI /// </summary> /// <param name="money">获得金钱</param> /// <param name="exp">获得经验</param> /// <param name="prop">获得宝物</param> /// <param name="skillType">获得的技能类型</param> public static void Refresh(int money, int exp, BaseProp prop, SkillRareDegree skillRareDegree) { var canvas = GameObject.Find("SubCanvasSpoil").GetComponent <Canvas>(); var txtExp = canvas.transform.Find("TxtExp").GetComponent <Text>(); var txtMoney = canvas.transform.Find("TxtMoney").GetComponent <Text>(); var text = canvas.transform.Find("Text").GetComponent <Text>(); var btnProp = canvas.transform.Find("BtnProp").GetComponent <Button>(); var btnUpgrade = canvas.transform.Find("BtnUpgrade").GetComponent <Button>(); txtExp.text = " X" + exp; txtMoney.text = " X" + money; if (prop == null) { btnProp.gameObject.SetActive(false); } else { btnProp.gameObject.SetActive(true); btnProp.image.sprite = SpriteHelper.GetPropSprite(prop.Name); EventTrigger trigger = btnProp.gameObject.GetComponent <EventTrigger>(); if (trigger == null) { trigger = btnProp.gameObject.AddComponent <EventTrigger>(); } trigger.triggers.Clear(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; entry.callback = new EventTrigger.TriggerEvent(); entry.callback.AddListener((eventdata) => { text.text = prop.Description; }); trigger.triggers.Add(entry); } if (skillRareDegree == SkillRareDegree.None) { btnUpgrade.gameObject.SetActive(false); } else { btnUpgrade.gameObject.SetActive(true); btnUpgrade.image.sprite = SpriteHelper.GetSkillRareDegreeSprite(skillRareDegree); EventTrigger trigger = btnUpgrade.gameObject.GetComponent <EventTrigger>(); if (trigger == null) { trigger = btnUpgrade.gameObject.AddComponent <EventTrigger>(); } trigger.triggers.Clear(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerEnter; entry.callback = new EventTrigger.TriggerEvent(); entry.callback.AddListener((eventdata) => { if (skillRareDegree == SkillRareDegree.Normal) { text.text = "选择并获得一本技能书"; } else if (skillRareDegree == SkillRareDegree.Rare) { text.text = "选择并获得一本稀有技能书"; } }); trigger.triggers.Add(entry); btnUpgrade.onClick.RemoveAllListeners(); btnUpgrade.onClick.AddListener(() => { BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.GetSkill); BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Spoil); BattleCanvasSetter.SwitchBattleScene(); }); } }
private static void ChooseEvent(GameEventType type) { var e = GameInfo.EventList.FirstOrDefault(x => x.Type == type).Clone(); GameInfo.OccurredEvents.Add(e); //GameInfo.NewStage(); //return; switch (type) { case GameEventType.Shop: { GameInfo.CurrentBattleScene = BattleSceneType.Shop; ShopUpdater.Refresh(); BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Shop); BattleCanvasSetter.SwitchBattleScene(); break; } case GameEventType.Treasure: { GameInfo.CurrentBattleScene = BattleSceneType.EventDialog; var prop = PropHelper.GetRandomVisibleProp(PropType.Normal); GameInfo.GainProp(prop.Name); EventHelper.GeneratePropEvent(e, prop.Name); DialogUpdater.Refresh(e); BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.EventDialog); BattleCanvasSetter.SwitchBattleScene(); break; } case GameEventType.Hotel: { GameInfo.CurrentBattleScene = BattleSceneType.EventDialog; EventHelper.GenerateHotelEvent(e); DialogUpdater.Refresh(e); BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.EventDialog); BattleCanvasSetter.SwitchBattleScene(); break; } case GameEventType.RandomEvent: { GameInfo.CurrentBattleScene = BattleSceneType.EventDialog; var randomE = EventHelper.GenerateRandomEvent(); DialogUpdater.Refresh(randomE); //如果队列中没有可用事件,则直接触发商店事件 if (randomE.Type == GameEventType.RandomEvent) { BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.EventDialog); } else { BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Shop); } BattleCanvasSetter.SwitchBattleScene(); break; } //case GameEventType. default: { GameInfo.CurrentBattleScene = BattleSceneType.Battling; BattleCanvasSetter.Scenes.Enqueue(BattleSceneType.Battling); BattleCanvasSetter.SwitchBattleScene(); break; } } }