Example #1
0
 public void ShowImgAddOn()
 {
     if (Vector3.zero == m_ImgAddOn.transform.localScale)
     {
         TweenPlayer.PlayTween(m_ImgAddOn.gameObject);
     }
 }
 private void Awake()
 {
     m_scale       = transform.localScale;
     m_fSpacing    = m_ListTransform.GetComponent <VerticalLayoutGroup>().spacing;
     m_TweenPlayer = transform.GetComponent <TweenPlayer>();
     if (null != m_ImageBG)
     {
         m_BG_Rect = m_ImageBG.GetComponent <RectTransform>();
     }
 }
Example #3
0
    /// <summary>
    /// 兵生变自己走棋
    /// </summary>
    /// <param name="to"></param>
    private void PromoteShowMove(Vector2 to)
    {
        if (m_TweenPlayer == null)
        {
            m_TweenPlayer = gameObject.AddComponent <TweenPlayer>();
        }
        Tween move_pos = m_TweenPlayer.AddClip("move", 2);

        move_pos.SetTweenType(TweenType.LocalPosition);
        move_pos.SetTo(new Vector3((to.x - 1) * Config.PieceWidth, 0, (to.y - 1) * Config.PieceWidth));
        move_pos.SetDuration(1);
        move_pos.SetOnComplete(OnProCompleteMove, null);
        m_TweenPlayer.StartPlay();
    }
Example #4
0
    public void OnUndo(Vector2 from)
    {
        m_undoFrom = from;
        if (m_TweenPlayer == null)
        {
            m_TweenPlayer = gameObject.AddComponent <TweenPlayer>();
        }
        Tween move_pos = m_TweenPlayer.AddClip("undo", 2);

        move_pos.SetTweenType(TweenType.LocalPosition);
        move_pos.SetTo(new Vector3((from.x - 1) * Config.PieceWidth, 0, (from.y - 1) * Config.PieceWidth));
        move_pos.SetDuration(1);
        move_pos.SetOnComplete(OnCompleteUndo, null);
        m_TweenPlayer.StartPlay();
    }
    private void OnFinish()
    {
        if (null != OnFinishEvent)
        {
            OnFinishEvent();
        }


        if (!Loop)
        {
            return;
        }
        transform.localScale = Vector3.one;
        TweenPlayer.PlayLoopTween(gameObject);
    }
Example #6
0
 public void OnImgAddOnPlayComplete()
 {
     m_ImgAddOn.Stop();
     if (m_ImgAddOn.Amount == Vector3.zero)
     {
         m_ImgAddOn.Amount = Vector3.one;
         m_ImgAddOn.Delay  = 0;
     }
     else
     {
         m_ImgAddOn.Amount = Vector3.zero;
         m_ImgAddOn.Delay  = 3;
         TweenPlayer.PlayTween(m_ImgAddOn.gameObject);
     }
 }
Example #7
0
 private void InitUIBinder(GameObject gameObject)
 {
     m_qizi        = GameObject.Find("qizi");
     m_chess       = m_qizi.gameObject.transform.Find("m_Chess").gameObject;
     m_worldCamera = GameObject.Find("Main Camera").GetComponent <Camera>();
     m_cameraTween = m_worldCamera.GetComponent <TweenPlayer>();
     m_userImage   = gameObject.transform.Find("Container/m_SelfIcon").GetComponent <Image>();
     m_enemyImage  = gameObject.transform.Find("Container/m_EnemyIcon").GetComponent <Image>();
     m_modelDrag   = GameObject.Find("board").GetComponent <ModelDrag>();
     m_ready       = gameObject.transform.Find("Container/m_Ready").gameObject.GetComponent <Button>();
     m_enemyReady  = gameObject.transform.Find("Container/m_EnemyReady").gameObject;
     m_test        = gameObject.transform.Find("Container/test").GetComponent <Button>();
     m_Undo        = gameObject.transform.Find("Container/m_Undo").GetComponent <Button>();
     m_animal      = GameObject.Find("Animal").GetComponent <Animator>();
 }
Example #8
0
    /// <summary>
    /// 其他人走棋
    /// </summary>
    /// <param name="from"></param>
    /// <param name="to"></param>
    public void DoMove(Vector2 from, Vector2 to, Vector2 type)
    {
        Debug.Log("from== " + from + "  to== " + to + "////// m_X== " + m_X + " m_Y== " + m_Z);
        if (from.x == m_X && from.y == m_Z)
        {
            var dx          = to.x - from.x;
            var dy          = to.y - from.y;
            var angle       = GetAngleByDeltaXY(dx, dy);
            var localAngle  = (angle) % 360;
            var targetPiece = App.ChessLogic02.GetPiece(to.x - 1, to.y - 1);//目标位置棋子
            if (App.ChessLogic02.DoMove(new Vector2(from.x - 1, from.y - 1), new Vector2(to.x - 1, to.y - 1)))
            {
                if (m_TweenPlayer == null)
                {
                    m_TweenPlayer = gameObject.AddComponent <TweenPlayer>();
                }

                if (m_ModelTween == null)
                {
                    m_ModelTween = pieceModel.AddComponent <TweenPlayer>();
                }

                var args = new object[] { from, to, new Vector2(type.x, targetPiece) };
                //攻击表现
                if (targetPiece > -1)
                {
                    ShowAttack(args);
                }

                //正常走棋
                else
                {
                    Tween rotate_start = m_ModelTween.AddClip("rotate_start", 1);
                    rotate_start.SetTweenType(TweenType.LocalRotation);
                    rotate_start.SetTo(new Vector3(0, localAngle, 0));
                    rotate_start.SetOnComplete(OnOtherRotate1Complete, args);
                    m_ModelTween.StartPlay();
                }
            }
            else
            {
                App.UIManager.OpenPanel("MessagePanel", "非法移动!from == " + from + "to == " + to + "type " + type);
                Debug.Log("非法移动!! On Other");
            }
        }
    }
Example #9
0
 private void InitUIBinder(GameObject gameObject)
 {
     m_bird       = gameObject.transform.Find("m_Bird").GetComponent <Image>();
     m_birdTween  = m_bird.GetComponent <TweenPlayer>();
     m_Mode       = gameObject.transform.Find("m_Mode").gameObject;
     m_Select     = gameObject.transform.Find("m_Select").gameObject;
     m_Searching  = gameObject.transform.Find("m_Searching").gameObject;
     m_PVE        = gameObject.transform.Find("m_Select/m_PVE").gameObject.GetComponent <Button>();
     m_PVP        = gameObject.transform.Find("m_Select/m_PVP").gameObject.GetComponent <Button>();
     m_PVP02      = gameObject.transform.Find("m_Select/m_PVP02").gameObject.GetComponent <Button>();
     m_PVP02Local = gameObject.transform.Find("m_Select/m_PVP02Test").gameObject.GetComponent <Button>();
     m_cancel     = gameObject.transform.Find("m_Searching/m_CancelBtn").gameObject.GetComponent <Button>();
     m_SearchTime = gameObject.transform.Find("m_Searching/m_SearchContainer/m_SearchTime").gameObject.GetComponent <Text>();
     m_Easy       = gameObject.transform.Find("m_Mode/m_Easy").gameObject.GetComponent <Button>();
     m_Normal     = gameObject.transform.Find("m_Mode/m_Normal").gameObject.GetComponent <Button>();
     m_Hard       = gameObject.transform.Find("m_Mode/m_Hard").gameObject.GetComponent <Button>();
 }
 private void PlayAppearAnim()
 {
     iTween.Stop(gameObject);
     if (IsScale)
     {
         transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
     }
     if (IsFade)
     {
         var ui = GetComponent <MaskableGraphic>();
         if (null != ui)
         {
             var color = ui.color;
             color.a  = 0;
             ui.color = color;
         }
     }
     TweenPlayer.PlayTween(gameObject, OnFinish);
 }
Example #11
0
    /// <summary>
    /// 自己走棋
    /// </summary>
    /// <param name="to"></param>
    private void ShowMove(object[] args)
    {
        var eatPiece = ((Vector2)args[2]).y;
        var to       = (Vector2)args[1];
        var from     = (Vector2)args[0];

        var dx         = to.x - from.x;
        var dy         = to.y - from.y;
        var angle      = GetAngleByDeltaXY(dx, dy);
        var localAngle = (angle) % 360;

        if (m_TweenPlayer == null)
        {
            m_TweenPlayer = gameObject.AddComponent <TweenPlayer>();
        }

        if (m_ModelTween == null)
        {
            m_ModelTween = pieceModel.AddComponent <TweenPlayer>();
        }

        //有棋子播放攻击表现
        if (eatPiece >= 0)
        {
            Tween rotate_start = m_ModelTween.AddClip("rotate_start", 1);
            rotate_start.SetTweenType(TweenType.LocalRotation);
            rotate_start.SetTo(new Vector3(0, localAngle, 0));
            rotate_start.SetOnComplete(ShowAttack, args);
            m_ModelTween.StartPlay();
        }

        //没有棋子直接走
        else
        {
            Debug.Log("localAngel==============" + localAngle);
            Tween rotate_start = m_ModelTween.AddClip("rotate_start", 1);
            rotate_start.SetTweenType(TweenType.LocalRotation);
            rotate_start.SetTo(new Vector3(0, localAngle, 0));
            rotate_start.SetOnComplete(OnRotate1Complete, args);
            m_ModelTween.StartPlay();
        }
    }
Example #12
0
 private void InitUIBinder(GameObject gameObject)
 {
     m_qizi          = GameObject.Find("qizi");
     m_piece         = m_qizi.gameObject.transform.Find("m_Chess").gameObject;
     m_worldCamera   = GameObject.Find("Main Camera").GetComponent <Camera>();
     m_cameraTween   = m_worldCamera.GetComponent <TweenPlayer>();
     m_selfTimerObj  = gameObject.transform.Find("Container/m_SelfTimer").gameObject;
     m_selfTimer     = m_selfTimerObj.transform.Find("Text").GetComponent <Text>();
     m_enemyTimerObj = gameObject.transform.Find("Container/m_EnemyTimer").gameObject;
     m_enemyTimer    = m_enemyTimerObj.transform.Find("Text").GetComponent <Text>();
     m_userImage     = gameObject.transform.Find("Container/m_SelfIcon").GetComponent <Image>();
     m_enemyImage    = gameObject.transform.Find("Container/m_EnemyIcon").GetComponent <Image>();
     m_modelDrag     = GameObject.Find("board").GetComponent <ModelDrag>();
     m_ready         = gameObject.transform.Find("Container/m_Ready").gameObject.GetComponent <Button>();
     m_enemyReady    = gameObject.transform.Find("Container/m_EnemyReady").gameObject;
     m_test          = gameObject.transform.Find("Container/test").GetComponent <Button>();
     m_Undo          = gameObject.transform.Find("Container/m_Undo").GetComponent <Button>();
     m_gameStartLogo = gameObject.transform.Find("Container/m_GameBegin").gameObject;
     m_globalLight   = GameObject.Find("GlobalLight");
 }
Example #13
0
    private void InitUIBinder(GameObject gameObject)
    {
        m_qizi            = GameObject.Find("qizi");
        m_piece           = m_qizi.gameObject.transform.Find("m_Chess").gameObject;
        m_worldCamera     = GameObject.Find("Main Camera").GetComponent <Camera>();
        m_cameraTween     = m_worldCamera.GetComponent <TweenPlayer>();
        m_selfTimerObj    = gameObject.transform.Find("Container/m_SelfTimer").gameObject;
        m_selfTimer       = m_selfTimerObj.transform.Find("Text").GetComponent <Text>();
        m_enemyTimerObj   = gameObject.transform.Find("Container/m_EnemyTimer").gameObject;
        m_enemyTimer      = m_enemyTimerObj.transform.Find("Text").GetComponent <Text>();
        m_userImage       = gameObject.transform.Find("Container/m_SelfIcon").GetComponent <Image>();
        m_enemyImage      = gameObject.transform.Find("Container/m_EnemyIcon").GetComponent <Image>();
        m_modelDrag       = GameObject.Find("board").GetComponent <ModelDrag02>();
        m_modelClick      = GameObject.Find("board").GetComponent <ModelClick>();
        m_ready           = gameObject.transform.Find("Container/m_Ready").gameObject.GetComponent <Button>();
        m_Bottom          = gameObject.transform.Find("Container/m_Bottom").gameObject;
        m_BottomToggle    = m_Bottom.GetComponent <Toggle>();
        m_EnergyContainer = m_Bottom.transform.Find("m_PowerContent/m_Energy").gameObject;
        m_EnergyText      = m_Bottom.transform.Find("m_PowerContent/m_EnergyWidget/m_EnergyText").GetComponent <Text>();

        m_EndTurn     = gameObject.transform.Find("Container/m_EndTurn").GetComponent <Button>();
        m_P           = gameObject.transform.Find("Container/m_Bottom/m_CardLineup/Scroll View/Viewport/Content/m_P").gameObject.GetComponent <Button>();
        m_N           = gameObject.transform.Find("Container/m_Bottom/m_CardLineup/Scroll View/Viewport/Content/m_N").gameObject.GetComponent <Button>();
        m_B           = gameObject.transform.Find("Container/m_Bottom/m_CardLineup/Scroll View/Viewport/Content/m_B").gameObject.GetComponent <Button>();
        m_R           = gameObject.transform.Find("Container/m_Bottom/m_CardLineup/Scroll View/Viewport/Content/m_R").gameObject.GetComponent <Button>();
        m_Q           = gameObject.transform.Find("Container/m_Bottom/m_CardLineup/Scroll View/Viewport/Content/m_Q").gameObject.GetComponent <Button>();
        m_enemyReady  = gameObject.transform.Find("Container/m_EnemyReady").gameObject;
        m_RoundChange = gameObject.transform.Find("Container/m_RoundChange").gameObject;
        m_sunLight    = GameObject.Find("Directional Light");
        m_BlackAnimal = GameObject.Find("m_Rabbit").GetComponent <Animator>();
        m_WhiteAnimal = GameObject.Find("m_Cat").GetComponent <Animator>();
        m_EnemyEnergy = gameObject.transform.Find("Container/m_EnergyWidget").gameObject;
        m_SelfSay     = gameObject.transform.Find("Container/m_SelfSay").GetComponent <Button>();
        m_EnemySay    = gameObject.transform.Find("Container/m_EnemySay").gameObject;
        m_SelectCloce = m_SelfSay.transform.Find("Select/m_SelectClose").GetComponent <Button>();
        m_Item1       = m_SelfSay.transform.Find("Select/Item1").GetComponent <Button>();
        m_Item2       = m_SelfSay.transform.Find("Select/Item2").GetComponent <Button>();
        m_Item3       = m_SelfSay.transform.Find("Select/Item3").GetComponent <Button>();
        m_Item4       = m_SelfSay.transform.Find("Select/Item4").GetComponent <Button>();
        m_SummonInfo  = gameObject.transform.Find("Container/m_Summon").gameObject.GetComponent <Text>();
    }
Example #14
0
    /// <summary>
    /// 远程攻击
    /// </summary>
    /// <param name="effectName"></param>
    /// <param name="to"></param>
    private void OnRemoteAttack(string effectName, object[] args)
    {
        var to   = (Vector2)args[1];
        var from = (Vector2)args[0];

        if (m_pieceAnimator == null)
        {
            m_pieceAnimator = pieceModel.GetComponent <Animator>();
        }
        m_pieceAnimator.Play("Attack");

        EffectPlayer effectPlayer = App.EffectManager.LoadEffect(m_Attack, effectName);

        effectPlayer.IsOnce = true;

        TweenPlayer m_AttackPlayer = m_Attack.AddComponent <TweenPlayer>();
        var         steps          = CalMoveSteps(from, to);
        Tween       attackTween    = m_AttackPlayer.AddClip("attack", steps * Config.AttackStepTime);

        attackTween.SetTweenType(TweenType.LocalPosition);
        attackTween.SetDelayTime(0.8f);
        attackTween.SetOnComplete(OnRemoteAttackComplete, args);

        App.SoundManager.PlaySoundClip(Config.Sound.MagicAttack, 0.6f);

        var dx = Config.PieceWidth * (to.x - m_X);
        var dy = Config.PieceWidth * (to.y - m_Z);

        attackTween.SetTo(new Vector3(dx, m_Attack.transform.localPosition.y, dy));
        var angle      = GetAngleByDeltaXY(dx, dy);
        var localAngle = (angle) % 360;

        m_AttackPlayer.gameObject.transform.rotation = Quaternion.Euler(0, localAngle, 0);
        //if (pieceColor == Config.PieceColor.WHITE)
        //{
        //    effectPlayer.LocalRotation = Quaternion.Euler(0, 180, 0);
        //}
        effectPlayer.enabled = true;
        m_AttackPlayer.StartPlay();
    }
Example #15
0
 private void InitUIBinder(GameObject gameObject)
 {
     m_Content     = gameObject.transform.Find("Image/m_Text").GetComponent <Text>();
     m_tweenPlayer = gameObject.transform.Find("Image").GetComponent <TweenPlayer>();
 }