Beispiel #1
0
    public void OpenView(object intent)
    {
        int firstId = m_pvpProxy.GetFirstId();
        int userId  = m_proxy.GetPlayerId();

        if (firstId == userId)
        {
            isTurn    = true;
            selfColor = Config.PieceColor.WHITE;
        }
        else
        {
            isTurn    = false;
            selfColor = Config.PieceColor.BLACK;
            m_globalLight.transform.localRotation = Quaternion.Euler(145, 30, 0);
        }
        m_pvpProxy.SetSelfColor(selfColor);
        m_userImage.GetComponentInChildren <Text>().text  = m_proxy.GetPlayerName();
        m_enemyImage.GetComponentInChildren <Text>().text = m_pvpProxy.GetEnemyName();
        InitTimer();
        App.SoundManager.PlaySoundClip(Config.Sound.InGameStart);
        var fixedK = App.EffectManager.ScreenFixedK;

        m_worldCamera.fieldOfView = m_worldCamera.fieldOfView * fixedK;
    }
Beispiel #2
0
 public Piece(Config.PieceColor color, Config.PieceType type, int x, int y)
 {
     this.color = color;
     this.type  = type;
     this.x     = x;
     this.y     = y;
 }
Beispiel #3
0
 public void OnGameOver(Config.PieceColor loseColor)
 {
     Debug.Log("GameOver!!");
     if (loseColor == selfColor)
     {
         App.UIManager.OpenPanel("ResultPanel", new object[] { Config.GameResult.LOSE, "-100" });
     }
     else
     {
         App.UIManager.OpenPanel("ResultPanel", new object[] { Config.GameResult.WIN, "+100" });
     }
 }
Beispiel #4
0
    public void InitView(GameObject gameObject, Piece pieceData, bool pve = false)
    {
        isPVE        = pve;
        m_gameObject = gameObject;
        //m_gameObject.transform.localRotation = Quaternion.Euler(0, 180, 0);
        m_Attack   = gameObject.transform.Find("m_Attack").gameObject;
        m_pvpProxy = App.Facade.RetrieveProxy("PVPProxy") as PVPProxy;
        selfColor  = m_pvpProxy.GetSelfColor();
        m_type     = pieceData.type;
        pieceColor = pieceData.color;
        InitPieceShow(pieceData);
        m_name     = m_X + "_" + m_Z;
        m_mediator = new PieceItemMediator(this, m_name);
        App.Facade.RegisterMediator(m_mediator);
        m_mediator.InitPieceData(pieceData);

        OpenView();
    }
Beispiel #5
0
 public void SetSelfColor(Config.PieceColor color)
 {
     m_pvpData.SelfColor = color;
 }
Beispiel #6
0
    public void OpenView(object intent)
    {
        isPause           = false;
        canNext           = true;
        m_needSendEndTurn = false;
        var rect = m_Bottom.GetComponent <RectTransform>();

        rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, rect.anchoredPosition.y - App.ScreenFixedHeight);
        m_EnergyText.text     = "0/0";
        int firstId = m_pvpProxy.GetFirstId();
        int userId  = m_proxy.GetPlayerId();

        //test
        m_isTest = m_pvpProxy.GetTestMode();
        if (m_isTest)
        {
            isTurn    = true;
            selfColor = Config.PieceColor.WHITE;
        }
        else
        {
            if (firstId == userId)
            {
                isTurn    = true;
                selfColor = Config.PieceColor.WHITE;
                App.ResourceManager.LoadResource <UnityEngine.Object>("ArtRes/Icon/CatBt", (UnityEngine.Object obj) =>
                {
                    if (obj != null)
                    {
                        var texture        = obj as Texture2D;
                        var sprite         = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                        m_userImage.sprite = sprite;
                    }
                });
                App.ResourceManager.LoadResource <UnityEngine.Object>("ArtRes/Icon/BunnyBt", (UnityEngine.Object obj) =>
                {
                    if (obj != null)
                    {
                        var texture         = obj as Texture2D;
                        var sprite          = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                        m_enemyImage.sprite = sprite;
                    }
                });
            }
            else
            {
                m_sunLight.transform.localRotation = Quaternion.Euler(145, -30, 0);
                isTurn    = false;
                selfColor = Config.PieceColor.BLACK;
                App.ResourceManager.LoadResource <UnityEngine.Object>("ArtRes/Icon/CatBt", (UnityEngine.Object obj) =>
                {
                    if (obj != null)
                    {
                        var texture         = obj as Texture2D;
                        var sprite          = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                        m_enemyImage.sprite = sprite;
                    }
                });
                App.ResourceManager.LoadResource <UnityEngine.Object>("ArtRes/Icon/BunnyBt", (UnityEngine.Object obj) =>
                {
                    if (obj != null)
                    {
                        var texture        = obj as Texture2D;
                        var sprite         = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                        m_userImage.sprite = sprite;
                    }
                });
            }
        }
        m_pvpProxy.SetSelfColor(selfColor);
        //m_userImage.GetComponentInChildren<Text>().text = m_proxy.GetPlayerName();
        m_enemyImage.GetComponentInChildren <Text>().text = m_pvpProxy.GetEnemyName();
        InitTimer();
        App.SoundManager.PlaySoundClip(Config.Sound.InGameStart);
        var fixedK = App.EffectManager.ScreenFixedK;

        m_worldCamera.fieldOfView = m_worldCamera.fieldOfView * fixedK;
    }