public void OnEventAppendRescueHintUI(BattleHeadUILogic.HeadUIParam param, int cardID) { HeadUI headUI = new HeadUI(); headUI.showTime = 0; if (Main.SettingManager.GameLanguage == 0) { headUI.uiGo = GameObject.Instantiate(view.panel_RescueHint.gameObject) as GameObject; } else { headUI.uiGo = GameObject.Instantiate(view.panel_RescueHint_En.gameObject) as GameObject; } headUI.uiGo.transform.SetParent(view.ui_Parent.transform); headUI.uiGo.gameObject.SetActive(true); Vector2 pos; headUI.image = headUI.uiGo.GetComponent <Image>(); Canvas canvas = headUI.image.canvas; pos = Camera.main.WorldToScreenPoint(param.goHead.transform.position); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, pos, null, out pos)) { headUI.rt = headUI.uiGo.GetComponent <RectTransform>(); headUI.rt.anchoredPosition = pos; } //headUI.rt.anchoredPosition = view.rescuePosList[cardID - 1].rectTransform.anchoredPosition; hintUIDict.Add(param.id, headUI); }
public void OnEventRemoveRescueHintUI(int id) { if (hintUIDict.ContainsKey(id)) { HeadUI headUI = hintUIDict[id]; if (headUI.uiGo != null) { Destroy(headUI.uiGo); } hintUIDict.Remove(id); } }
public void OnEventRemoveWeaponUI(int id) { if (weaponUIDict.ContainsKey(id)) { HeadUI headUI = weaponUIDict[id]; if (headUI.uiGo != null) { Destroy(headUI.uiGo); } weaponUIDict.Remove(id); } }
public void OnEventAppendBossHeadUI(BattleHeadUILogic.HeadUIParam param) { view.panel_BossHPBar.gameObject.SetActive(true); view.slider_BossHPBar1.value = 1.0f; view.slider_BossHPBar2.value = 1.0f; view.slider_BossHPBar3.value = 1.0f; view.image_BossHPNum1.gameObject.SetActive(false); view.image_BossHPNum2.gameObject.SetActive(false); view.image_BossHPNum3.gameObject.SetActive(true); HeadUI headUI = new HeadUI(); headUIDict.Add(param.id, headUI); }
public void OnEventUpdateMonsterHeadUI(BattleHeadUILogic.HeadUIParam param) { if (headUIDict.ContainsKey(param.id)) { HeadUI headUI = headUIDict[param.id]; if (!headUI.uiGo.gameObject.activeSelf && param.damage == 0) { return; } Vector2 pos; Canvas canvas = headUI.image.canvas; pos = Camera.main.WorldToScreenPoint(param.goHead.transform.position); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, pos, null, out pos)) { headUI.rt.anchoredPosition = pos; } headUI.bar.value = (float)param.min / (float)param.max; if (param.damage > 0) { switch (param.type) { case Monster.MonsterType.Senior: case Monster.MonsterType.Normal: { headUI.showTime += GameConfig.GAME_CONFIG_SHOW_HEAD_UI_TIME_1; break; } case Monster.MonsterType.NPC: { headUI.showTime += GameConfig.GAME_CONFIG_SHOW_HEAD_UI_TIME_2; break; } } } headUI.showTime -= Main.NonStopTime.deltaTime; if (headUI.showTime <= 0.0f) { headUI.showTime = 0.0f; headUI.uiGo.gameObject.SetActive(false); } else { headUI.uiGo.gameObject.SetActive(true); } } }
public void OnEventRemoveHeadUI(int id) { if (headUIDict.ContainsKey(id)) { HeadUI headUI = headUIDict[id]; if (headUI.uiGo != null) { Destroy(headUI.uiGo); } else { view.panel_BossHPBar.gameObject.SetActive(false); } headUIDict.Remove(id); } }
public void OnEventUpdateWeaponUI(BattleHeadUILogic.HeadUIParam param) { if (weaponUIDict.ContainsKey(param.id)) { HeadUI headUI = weaponUIDict[param.id]; if (!headUI.uiGo.gameObject.activeSelf) { return; } Vector2 pos; Canvas canvas = headUI.image.canvas; pos = Camera.main.WorldToScreenPoint(param.goHead.transform.position); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, pos, null, out pos)) { headUI.rt.anchoredPosition = pos; } if (param.damage > 0) { headUI.showTime += GameConfig.GAME_CONFIG_SHOW_HEAD_UI_TIME_1; GameObject goFX = GameObject.Instantiate(view.panel_HitBoss.gameObject) as GameObject; goFX.transform.SetParent(view.ui_Parent.transform); goFX.gameObject.SetActive(true); goFX.GetComponent <RectTransform>().anchoredPosition = pos; goFX.GetComponent <RectTransform>().localScale = Vector3.one; StartCoroutine(OnCreateHitBossFX(goFX)); } headUI.showTime -= Main.NonStopTime.deltaTime; if (headUI.showTime <= 0.0f) { headUI.showTime = 0.0f; Slider hpBar = headUI.uiGo.transform.Find("Panel_Bar/Image_HPBar").GetComponent <Slider>(); headUI.uiGo.transform.Find("Panel_Bar").gameObject.SetActive(false); } else { Slider hpBar = headUI.uiGo.transform.Find("Panel_Bar/Image_HPBar").GetComponent <Slider>(); headUI.uiGo.transform.Find("Panel_Bar").gameObject.SetActive(true); hpBar.value = (float)param.min / (float)param.max; } } }
public void OnEventUpdateRescueHintUI(BattleHeadUILogic.HeadUIParam param, int cardID) { if (hintUIDict.ContainsKey(param.id)) { HeadUI headUI = hintUIDict[param.id]; if (!headUI.uiGo.gameObject.activeSelf) { return; } //Vector2 pos; //Canvas canvas = headUI.image.canvas; //pos = Camera.main.WorldToScreenPoint(param.goHead.transform.position); //if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, pos, null, out pos)) //{ // headUI.rt.anchoredPosition = pos; //} headUI.rt.anchoredPosition = view.rescuePosList[cardID - 1].rectTransform.anchoredPosition; } }
public void OnEventAppendMonsterHeadUI(BattleHeadUILogic.HeadUIParam param) { HeadUI headUI = new HeadUI(); headUI.showTime = 0; switch (param.type) { case Monster.MonsterType.Senior: case Monster.MonsterType.Normal: { headUI.uiGo = GameObject.Instantiate(view.panel_RedHPBar.gameObject) as GameObject; break; } case Monster.MonsterType.NPC: { headUI.uiGo = GameObject.Instantiate(view.panel_GreenHPBar.gameObject) as GameObject; break; } } headUI.uiGo.transform.SetParent(view.ui_Parent.transform); //headUI.uiGo.gameObject.SetActive(true); Vector2 pos; headUI.image = headUI.uiGo.GetComponent <Image>(); Canvas canvas = headUI.image.canvas; pos = Camera.main.WorldToScreenPoint(param.goHead.transform.position); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, pos, null, out pos)) { headUI.rt = headUI.uiGo.GetComponent <RectTransform>(); headUI.rt.anchoredPosition = pos; } headUI.bar = headUI.uiGo.transform.Find("Image_HPBar").GetComponent <Slider>(); headUI.bar.value = (float)param.min / (float)param.max; headUIDict.Add(param.id, headUI); }
public void OnEventAppendWeaponUI(BattleHeadUILogic.HeadUIParam param) { HeadUI headUI = new HeadUI(); headUI.showTime = 0; headUI.uiGo = GameObject.Instantiate(view.panel_Weapon.gameObject) as GameObject; headUI.uiGo.transform.SetParent(view.ui_Parent.transform); headUI.uiGo.gameObject.SetActive(true); Vector2 pos; headUI.image = headUI.uiGo.GetComponent <Image>(); Canvas canvas = headUI.image.canvas; pos = Camera.main.WorldToScreenPoint(param.goHead.transform.position); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, pos, null, out pos)) { headUI.rt = headUI.uiGo.GetComponent <RectTransform>(); headUI.rt.anchoredPosition = pos; headUI.rt.localScale = Vector3.one; } weaponUIDict.Add(param.id, headUI); }