コード例 #1
0
    public void OnInitGame()
    {
        CardGameManager._INSTANCE.FadeScreen(delegate() {
            SetActive(UIGame, true);
            SetActive(UILobby, false);
            SetActive(UIPostMatch, false);
            SetActive(BackgroundTexture.gameObject, true);
            for (int i = 0; i < seats.Length; i++)
            {
                seats [i].transform.position = seatsPos [i].position;
                seats [i].totalCardSrite.gameObject.SetActive(true);
            }
        });


        TimerAlarm.LazyTimer(.5f, delegate() {
            for (sbyte i = 0; i < buttons.Length; i++)
            {
                buttons [i].gameObject.SetActive(true);
                buttons [i].GetComponent <UIButton> ().enabled = false;
                //buttons [i].transform.position = startPosition [Random.Range (0, startPosition.Length)].position;
                //MoveToBorn (i, buttons [i].transform.rotation);
            }

            Helper.Shuffle(startPosition);
            for (sbyte i = 0; i < buttons.Length; i++)
            {
                buttons [i].transform.SetParent(startPosition [i].transform);
                buttons [i].transform.localPosition = new Vector2(0f, 0f);
                Debug.Log("startPosition [r]  " + startPosition [i].name);
            }
        });
    }
コード例 #2
0
    public void MoveFalse(int index, int listener)
    {
        Debug.Log("index " + index + " listener " + listener);

        for (int i = 0; i < seats.Length; i++)
        {
            if (seats [i].userId == listener)
            {
                Move(index, i);
                seats [i].wrongIcon.gameObject.SetActive(true);
                NGUITools.AddChild(seats [i].gameObject, wrongFx);
                TimerAlarm.LazyTimer(.1f, delegate() {
                    SoundControl.shared.PlayEffectSound("WrongAnswer");
                });
            }
            else
            {
                if (seats [i].wrongIcon.gameObject.activeSelf)
                {
                    seats [i].wrongIcon.gameObject.SetActive(true);
                }
                else
                {
                    seats [i].wrongIcon.gameObject.SetActive(false);
                }
            }
        }
    }
コード例 #3
0
 //Switch Tab
 void OnCloseTab()
 {
     TimerAlarm.LazyTimer(.2f, delegate() {
         for (int i = 0; i < tabview.Length; i++)
         {
             tabview [i].gameObject.SetActive(false);
             tabSprite [i].enabled = false;
             //onTab = false;
         }
     });
 }
コード例 #4
0
    void OnClose(GameObject obj)
    {
        SoundControl.shared.PlayEffectSound("Click");
        PopupTweenClose(obj);
        BackDrop.SetActive(false);

        TimerAlarm.LazyTimer(.2f, delegate() {
            obj.SetActive(false);
            ENABLEDALL();
        });
    }
コード例 #5
0
    public void MoveToCoin()
    {
        coin.gameObject.SetActive(true);
        coin.gameObject.transform.position = pileCard.transform.position;

        TimerAlarm.LazyTimer(.1f, delegate() {
            SoundControl.shared.PlayEffectSound("CoinRoomSound");
        });

        iTween.MoveTo(coin.gameObject, iTween.Hash(
                          "position", coinsPos.transform,
                          "time", speed,
                          "onCompleteTarget", this.gameObject,
                          "onComplete", "onCompleteMoveToCoin",
                          "easetype", iTween.EaseType.easeInOutBack
                          ));

        iTween.ScaleTo(coin.gameObject, iTween.Hash(
                           "scale", new Vector3(.6f, .6f, .6f),
                           "speed", speed,
                           "easetype", iTween.EaseType.easeInOutBack
                           ));
    }
コード例 #6
0
    private void UpdateAll()
    {
        Cards lastcard = CardGame.room.lastCardIndex;
        int   offset   = CardGame.room.seatId;
        int   active   = CardGame.CARD_ACTIVE_TRUE;
        sbyte layout   = CardGame.room.layout;

        //sbyte status = CardGame.room.statusCard;

        //// Setting Room ////
        if (CardGame.room.gameState != GameState.INIT_MATCH)
        {
            remainCard.text = "X " + (CardGame.room.remainCard - cardInRoom);
            coinsRoom.text  = CardGame.room.coinsRoom.ToString();
        }
        //// Setting Player ////
        for (sbyte i = 0; i < CardGame.MAX_SEAT; i++)
        {
            seats[i].userId          = CardGame.room.GetPlayer(offset).user.userId;
            seats[i].uname.text      = CardGame.room.GetPlayer(offset).user.name;
            seats [i].ulevel.text    = CardGame.room.GetPlayer(offset).user.level.ToString();
            seats [i].totalCard.text = CardGame.room.GetPlayer(offset).remainCardPlayer.ToString();

            if (CardGame.room.GetPlayer(offset).user.userId != CardGame.FREE_USER_SLOT)
            {
                seats[i].upicture.mainTexture = CardGameManager._INSTANCE.charactersData[CardGame.room.GetPlayer(offset).user.character - 1].character;
            }
            else
            {
                seats[i].upicture.mainTexture = null;
            }
            seats[i].upicture.gameObject.SetActive(CardGame.room.GetPlayer(offset).user.userId != CardGame.FREE_USER_SLOT);

            offset = (offset + 1) % CardGame.MAX_SEAT;
        }

        if (CardGame.room.gameState == GameState.WAIT)
        {
            Debug.Log("GameState.WAIT");
            _UIManager.gameState.GetComponent <UILocalize> ().key = "StateWait";
        }

        if (CardGame.room.gameState == GameState.LOADING)
        {
            Debug.Log("GameState.LOADING");
            _UIManager.gameState.GetComponent <UILocalize> ().key = "StateLoading";
            _UIManager.gameState.GetComponent <UILabel> ().text   = Localization.Get(_UIManager.gameState.GetComponent <UILocalize> ().key);
            Debug.Log(_UIManager.gameState.GetComponent <UILocalize> ().key);

            if (PrefManager.Lifes > 0)
            {
                PrefManager._INSTANCE.SpendLife(1);
                Debug.Log("SpendLife");
            }
            _UIManager.SettingLayout(layout);
        }
        if (CardGame.room.gameState == GameState.INIT_MATCH)
        {
            Debug.Log("GameState.INIT_MATCH");
            _UIManager.OnInitGame();
            bgSound = true;
            Debug.Log("bgSound" + bgSound);
        }
        if (CardGame.room.gameState == GameState.FLOD_CARD)
        {
            Debug.Log("GameState.FLOD_CARD");
            _UIManager.ItweenFoldCard();
            timer = false;
            timeSprite.gameObject.SetActive(false);
            pileId.text    = "";
            pileClubs.text = "";
            drawCard       = true;
            _UIManager.ResetMove();

            for (int i = 0; i < buttons.Length; i++)
            {
                buttons [i].gameObject.SetActive(true);
            }
        }

        if (CardGame.room.gameState == GameState.IN_MATCH || CardGame.room.gameState == GameState.CALCULATE_MATCH)
        {
            Debug.Log("GameState.IN_MATCH");
            if (drawCard)
            {
                _UIManager.ItweenDrawCard();
                pileId.text          = lastcard.id.ToString();
                pileClubs.text       = lastcard.club.ToString();
                pileCard.mainTexture = Resources.Load("Cards/" + layout + "/" + lastcard.id) as Texture;

                if (onCompleteDrawCard)
                {
                    timer = true;
                    TimerAlarm.LazyTimer(.5f, delegate() {
                        timeSprite.gameObject.SetActive(true);
                    });
                    for (int i = 0; i < buttons.Length; i++)
                    {
                        buttons [i].GetComponent <UIButton> ().enabled = true;
                    }
                    for (int i = 0; i < canMove.Length; i++)
                    {
                        canMove [i] = true;
                    }
                    onCompleteDrawCard = false;
                }

                drawCard = false;
            }

            if (CardGame.room.GetButton(0) == CardGame.STATUS_DEFAULT && canMove[0])
            {
                CheckStatus(0);
            }
            if (CardGame.room.GetButton(1) == CardGame.STATUS_DEFAULT && canMove[1])
            {
                CheckStatus(1);
            }
            if (CardGame.room.GetButton(2) == CardGame.STATUS_DEFAULT && canMove[2])
            {
                CheckStatus(2);
            }
            if (CardGame.room.GetButton(3) == CardGame.STATUS_DEFAULT && canMove[3])
            {
                CheckStatus(3);
            }
            if (CardGame.room.GetButton(4) == CardGame.STATUS_DEFAULT && canMove[4])
            {
                CheckStatus(4);
            }


            if (bgSound)
            {
                SoundControl.shared.PlayBackgroundSound("InMatchSound");
                bgSound = false;
            }

            onTouch = true;
        }

        if (CardGame.room.gameState == GameState.CALCULATE_MATCH)
        {
            Debug.Log("GameState.CALCULATE_MATCH");
        }

        if (CardGame.room.gameState == GameState.POST_MATCH)
        {
            Debug.Log("GameState.POST_MATCH");
            _UIManager.OnPostMatch();
        }

        if (CardGame.room.gameState == GameState.SHOW_RESULT)
        {
            Debug.Log("GameState.SHOW_RESULT");
            _UIManager.ShowResult();
            _UIManager.ResetMove();


            for (sbyte i = 0; i < seats.Length; i++)
            {
                seats [i].winnerSeatId = CardGame.room.GetPlayer(offset).winnerSeatId;
                seats [i].xp.text      = CardGame.room.GetPlayer(offset).exp.ToString();
                seats [i].coins.text   = CardGame.room.GetPlayer(offset).coins.ToString();

                _UIManager.SetRank(i, seats[i].winnerSeatId);
                offset = (offset + 1) % CardGame.MAX_SEAT;
            }

            if (onceResult)
            {
                onceResult = false;
                SoundControl.shared.PlayEffectSound("Result");
            }
        }
    }