// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(1) && App.operateEmail.Equals(UserInfo.email) && isInArray(this.turnStates, App.TurnState) && !App.isOfferState) { if (GUIOp.isInGUI(Input.mousePosition, this.gameObject)) { // 生成菜单 GameObject menuPanelObj = Instantiate(this.menuPrefab); // 菜单挂到canvas下 menuPanelObj.transform.SetParent(GameObject.Find("Canvas").transform); // 设置菜单大小 menuPanelObj.GetComponent <RectTransform>().anchorMin = new Vector2(0.5f, 0.5f); menuPanelObj.GetComponent <RectTransform>().anchorMax = new Vector2(0.5f, 0.5f); float menuWidth = GameObject.Find("MHandPanel/Scroll View/Viewport/Content").GetComponent <GridLayoutGroup>().cellSize.x; menuPanelObj.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, menuWidth); menuPanelObj.GetComponent <GridLayoutGroup>().cellSize = new Vector2(menuWidth, menuWidth / 160 * 50); // 设置菜单位置 menuPanelObj.transform.position = new Vector3( this.gameObject.transform.position.x, this.gameObject.transform.position.y + this.gameObject.GetComponent <RectTransform>().rect.height); // 设置菜单需要操作的目标卡片 menuPanelObj.GetComponent <MenuAction>().operateCardObj = this.gameObject; } } }
void Update() { // 左键选中 if (Input.GetMouseButtonDown(0) && App.isOfferState) { if (GUIOp.isInGUI(Input.mousePosition, this.gameObject)) { showSelectCursor(); // 判断自己是否已经存在 if (isExistInArray(this.gameObject.transform.parent.gameObject.name)) { clearSelectCursor(); App.isOfferState = false; return; } else { App.selectList.Add(this.gameObject.transform.parent.gameObject.name); } if (App.selectList.Count == App.selectLimit) { CallAction(); clearSelectCursor(); App.isOfferState = false; } } } }
// Update is called once per frame void Update() { if (GUIOp.isInGUI(Input.mousePosition, this.gameObject)) { if (Input.GetMouseButtonDown(0)) { jumpPage(this.gameObject.GetComponent <ShowCardInfo>().cardId); } } }
// Update is called once per frame void Update() { // 检测按键 if (GUIOp.isInGUI(Input.mousePosition, this.gameObject)) { if (Input.GetMouseButtonDown(0)) { addCardToDeck(); } else if (Input.GetMouseButtonDown(1)) { subCardFromDeck(); } } }
void Update() { // 左键选中 if (Input.GetMouseButtonDown(0) && App.TurnState.Equals("BP")) { if (GUIOp.isInGUI(Input.mousePosition, this.gameObject)) { // 判断是敌方怪兽还是我方怪兽 if (this.gameObject.transform.parent.parent.parent.parent.gameObject.name.Equals("MyPanel")) { if (App.selectList.Count != 0) { clearSelectCursor(); return; } } else { if (App.selectList.Count == 0) { MsgBox.showMsg("先选择我方怪兽"); return; } } showSelectCursor(); App.selectList.Add(this.gameObject.transform.parent.gameObject.name); Debug.Log("aaa"); // 判断敌方是否有怪兽 if (!existEnemyMonster()) { AttackMonsterAction(true); clearSelectCursor(); } else { Debug.Log("App.selectList.Count:" + App.selectList.Count); Debug.Log("App.selectLimit:" + App.selectLimit); if (App.selectList.Count == App.selectLimit) { AttackMonsterAction(); clearSelectCursor(); } } } } }
// Update is called once per frame void Update() { // 点击左键取消菜单 if (Input.GetMouseButtonDown(0)) { // 如果不在自己的范围内 if (!GUIOp.isInGUI(Input.mousePosition, this.gameObject)) { closeMyself(); } } else if (Input.GetMouseButtonDown(1)) { // 右键直接取消菜单 closeMyself(); } }
// Update is called once per frame void Update() { if (GUIOp.isInGUI(Input.mousePosition, this.gameObject)) { if (this.duration == -1) { this.duration = DateTime.Now.Ticks; } else { if (DateTime.Now.Ticks > this.duration + this.durationLimit) { showCardInfo(); } } } else { this.duration = -1; } }