コード例 #1
0
 void OnHover(bool isOver)
 {
     if(isOver && guiCard == null) {
         guiCard = ((GameObject) Object.Instantiate(Assets.Instance.CardPrefab)).GetComponent<GUICard>();
         guiCard.SetInfo(Card, GameControl.gameControl.ThisPlayer);
         guiCard.ForcePlaceCard(GameControl.gameControl.GuiControl.MousePosition.x, GameControl.gameControl.GuiControl.MousePosition.y);
         guiCard.HandCard = false;
     } else if(guiCard != null) {
         Destroy(guiCard);
     }
 }
コード例 #2
0
    void OnGUI()
    {
        MousePosition = Event.current.mousePosition;
        GUI.depth = 1;
        enemyStatsObject.text = "Opponent\nCards in Deck: " + gameControl.EnemyPlayer.Deck.Count  +
            "\nCards in Hand: " + gameControl.EnemyPlayer.Hand.Count +
                "\nMana: " + gameControl.EnemyPlayer.ManaLeft() + " / " + gameControl.EnemyPlayer.MaxMana +
                "\nVictory Points: " + gameControl.EnemyPlayer.Points + " / " + Settings.VictoryRequirement;

        playerStatsObject.text = "You\nCards in Deck: " + gameControl.ThisPlayer.Deck.Count  +
            "\nCards in Hand: " + gameControl.ThisPlayer.Hand.Count +
                "\nMana: " + gameControl.ThisPlayer.ManaLeft() + " / " + gameControl.ThisPlayer.MaxMana +
                "\nVictory Points: " + gameControl.ThisPlayer.Points + " / " + Settings.VictoryRequirement;

        if(gameControl.MouseControl.selectedUnit != null && gameControl.MouseControl.selectedUnit.Team != Team.NEUTRAL) {
            ShowSelUnitBox();
            ShowSelUnitInfo(gameControl.MouseControl.selectedUnit);
            GUI.DrawTexture(imageRect, selUnitTexture);
            if(imageRect.Contains(Event.current.mousePosition)) {
                if(guiCard == null) {
                    guiCard = ((GameObject) Object.Instantiate(Assets.Instance.CardPrefab)).GetComponent<GUICard>();
                    guiCard.SetInfo(gameControl.MouseControl.selectedUnit.Card, gameControl.MouseControl.selectedUnit.Team == Team.ME ? gameControl.ThisPlayer : gameControl.EnemyPlayer);
                    guiCard.ForcePlaceCard(Event.current.mousePosition.x, Event.current.mousePosition.y);
                    guiCard.HandCard = false;
                }  else {
                    guiCard.SetPosition(Event.current.mousePosition.x, Event.current.mousePosition.y);
                }
            } else {
                if(guiCard != null) guiCard.Kill();
            }
        } else {
            HideSelUnitBox();
            HideSelUnitInfo();
        }
        if(gameControl.MouseControl.mouseOverHex != null && gameControl.MouseControl.mouseOverHex.Unit != null && gameControl.MouseControl.mouseOverHex.Unit.Team != 0) {
            if(oldHex == null || oldHex != gameControl.MouseControl.mouseOverHex) {
                oldHex = gameControl.MouseControl.mouseOverHex;
                popUp.x = Camera.main.WorldToScreenPoint(oldHex.transform.position).x;
                popUp.y = -(Camera.main.WorldToScreenPoint(oldHex.transform.position).y-Screen.height);
            }
            GUI.skin = Assets.Instance.Skin;
            GUI.Box (new Rect(popUp.x+30, popUp.y-30, 150, 100), GetMouseOverString(gameControl.MouseControl.mouseOverHex.Unit));
        }
    }