/// <summary> /// 查看英雄装备的奥义 /// </summary> /// <param name="item"></param> /// <param name="isPressed"></param> void SeeHeroArcaneInfo(UIGridItem item, bool isPressed) { RaycastHit hit; Ray ray; UIGridItem hitItem; if (item.mScripts[2] == null) { return; } if (isPressed) { Facade.SendNotification(NotificationID.ArcaneInfoOpen, item); startPos = item; item.GetComponent <UIGridItem>().mScripts[2].GetComponent <CardRole>().ShowHighlighter(); ResourceManager.Instance.LoadPrefab("linerender", LoadLineRenderComplete, LoadFail, item.gameObject); } else { panel.startPos.gameObject.SetActive(false); item.GetComponent <UIGridItem>().mScripts[2].GetComponent <CardRole>().HideHighlighter(); if (ArcaneInfoMediator.arcaneInfoMediator != null) { Facade.SendNotification(NotificationID.ArcaneInfoClose); } if (Main.Ins.lineRender != null) { MonoBehaviour.DestroyImmediate(Main.Ins.lineRender.gameObject); Main.Ins.lineRender = null; } Main.Ins.Camera3D.gameObject.SetActive(false); ray = UICamera.currentCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { if (hit.collider.transform.name.Contains("hero") && hit.collider.GetComponent <UIGridItem>() != null) { hitItem = hit.collider.GetComponent <UIGridItem>(); if (hitItem.mScripts[2] != null) { hitItem.mScripts[2].GetComponent <CardRole>().HideHighlighter(); } SwitchTwoHeroPosition(startPos, hit.collider.GetComponent <UIGridItem>()); } } } }
protected override void OnDragDropMove(Vector3 delta) { if (Main.Ins.lineRender != null) { distance = Vector3.Distance(UICamera.currentCamera.ScreenToWorldPoint(Input.mousePosition), Main.Ins.lineRender.tragetV3); } if (distance > 0.3f && !Main.Ins.Camera3D.gameObject.activeSelf) { Main.Ins.Camera3D.gameObject.SetActive(true); } if (ArcaneInfoMediator.arcaneInfoMediator != null) { Facade.Instance.SendNotification(NotificationID.ArcaneInfoClose); } RaycastHit hit; Ray ray; ray = UICamera.currentCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { if (hit.collider.transform.name.Contains("hero") && hit.collider.GetComponent <UIGridItem>() != null) { hitItem = hit.collider.GetComponent <UIGridItem>(); if (lastItem != null && (lastItem.oData as HeroInfo).heroUUId > 0) { lastItem.GetComponent <UIGridItem>().mScripts[2].GetComponent <CardRole>().HideHighlighter(); } if (hitItem.mScripts[2] != null) { hitItem.mScripts[2].GetComponent <CardRole>().ShowHighlighter(); } lastItem = hitItem; } else { if (lastItem != null && (lastItem.oData as HeroInfo).heroUUId > 0) { lastItem.GetComponent <UIGridItem>().mScripts[2].GetComponent <CardRole>().HideHighlighter(); } } } }
/// <summary> /// 加载英雄预设成功 /// </summary> /// <param name="abName"></param> /// <param name="obj"></param> /// <param name="param"></param> void LoadComplete(string abName, GameObject obj, object param) { UIGridItem trans = param as UIGridItem; obj.transform.parent = trans.mScripts[3].transform; GUIManager.ChangeLayer(obj, "UI"); trans.GetComponent <UIGridItem>().mScripts[2] = obj.GetComponent <CreateSpineAni>(); obj.GetComponent <CreateSpineAni>().SpineScale = Vector3.one * 2; obj.GetComponent <BoxCollider>().enabled = false; obj.transform.localPosition = new Vector3(0, -212, 0); }
/// <summary> /// 点击球员 /// </summary> /// <param name="data"></param> /// <param name="go"></param> private void ClickPlayerItem(UIGridItem item) { if (item == null || item.mScripts == null || item.oData == null) { return; } MyUIToggle toggle = item.GetComponent <MyUIToggle>(); if (toggle.Value == true) { return; } cur_equip = null; toggle.Value = true; int player_id = GameConvert.IntConvert(item.oData); cur_select_player_id = player_id; SetEquipGridInfo(player_id); OpenFunction(); }
/// <summary> /// 刷新小队信息 /// </summary> /// <param name="item"></param> void UpdateTeamGrid(UIGridItem item) { if (item == null || item.oData == null || item.mScripts == null) { return; } item.onClick = ChooseItem; SelectTeamMsg info = item.oData as SelectTeamMsg; UILabel name = item.mScripts[0] as UILabel; UILabel id = item.mScripts[1] as UILabel; UISprite addBtn = item.mScripts[2] as UISprite; UILabel haveTeam = item.mScripts[3] as UILabel; haveTeam.gameObject.SetActive(info.teamId > 0); addBtn.gameObject.SetActive(info.teamId < 0); item.GetComponent <BoxCollider>().enabled = info.teamId > 0; UIEventListener.Get(addBtn.gameObject).onClick = CeateTeam; if (info.teamId < 0) { return; } name.text = info.teamName; id.text = info.teamId.ToString(); TD_Hero hero = null; for (int i = 0; i < 4; ++i) { if (info.configIdList.Count > i) { hero = HeroConfig.GetItem(info.configIdList[i]); LoadSprite.LoaderHead(haveTeam.transform.FindChild(i.ToString()).GetComponent <UITexture>(), hero.headRes); } else { haveTeam.transform.FindChild(i.ToString()).GetComponent <UITexture>().material = null; } } }