예제 #1
0
        protected virtual void Resiste(int id, EventData data)
        {
            EventID.GameEventId type = (EventID.GameEventId)id;
            switch (type)
            {
            case EventID.GameEventId.OnTrusteeshipOpen:
                CanQuit       = false;
                IsTrusteeship = true;
                EventDispatch.Dispatch((int)EventID.GameEventId.ChangeButtonIcon, new EventData(0, true));
                StartCoroutine("StartGameByTrust");
                break;

            case EventID.GameEventId.OnCancelTrusteeship:
                CanQuit       = true;
                IsTrusteeship = false;
                StopCoroutine("ReStartGameBySelf");
                EventDispatch.Dispatch((int)EventID.GameEventId.ChangeButtonIcon, new EventData(0, false));
                break;

            case EventID.GameEventId.WhenIconStop:
                OnStopBySelf();
                break;

            case EventID.GameEventId.OnCloseBtnClick:
                OnQuitGameClick();
                break;

            default:
                ResisteOther(id, data);
                break;
            }
        }
예제 #2
0
 public virtual void StopRoll()
 {
     //停止播放滚动声音
     InitData();
     StopRollJettonNow();
     EventDispatch.Dispatch((int)EventID.GameEventId.WhenIconStop);
 }
예제 #3
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            YxDebug.Log("------> RemoteServer: OnServerResponse() CMDID = rqst and type = " + type + "" + "! \n");
            switch ((RequestCmd)type)
            {
            case RequestCmd.CmdStartGame:
                YxDebug.Log("开始游戏");
                CanQuit = false;
                Facade.Instance <MusicManager>().Stop();
                App.GetGameData <OverallData>().SetResponseData(response);
                StopAllCoroutines();
                EventDispatch.Dispatch((int)EventID.GameEventId.PlayInsertCoinsAnim);
                EventDispatch.Dispatch((int)EventID.GameEventId.StartRollJetton);
                EventDispatch.Dispatch((int)EventID.GameEventId.GetIconOrder);
                //播放滚动声音
                break;

            case RequestCmd.CmdCaiChiChange:
                YxDebug.Log("彩池变化");
                long caichi = response.GetLong("caichi");
                EventDispatch.Dispatch((int)EventID.GameEventId.AlterPotGold, new EventData(caichi));
                break;

            case RequestCmd.CmdGetMessageWhenWin:
                YxDebug.Log("中彩通知");
                var data = response.GetUtfString("data");
                StartCoroutine(ShowNotice(data));
                break;
            }
        }
예제 #4
0
        protected virtual IEnumerator StartGameByTrust()
        {
            yield return(new WaitForSeconds(0.5f));

            EventDispatch.Dispatch((int)EventID.GameEventId.OnStartClick);
            EventDispatch.Dispatch((int)EventID.GameEventId.ChangeButtonIcon, new EventData(3));
        }
예제 #5
0
        protected virtual IEnumerator ReStartGameBySelf(float wait)
        {
            yield return(new WaitForSeconds(wait));

            if (IsTrusteeship)
            {
                EventDispatch.Dispatch((int)EventID.GameEventId.OnStartClick);
                EventDispatch.Dispatch((int)EventID.GameEventId.ChangeButtonIcon, new EventData(3));
            }
        }
예제 #6
0
        protected virtual IEnumerator HideAllEffectAfter(float wait)
        {
            yield return(new WaitForSeconds(wait - 1.5f));

            if (!IsTrusteeship)
            {
                EventDispatch.Dispatch((int)EventID.GameEventId.ChangeButtonIcon, new EventData(0));
            }
            yield return(new WaitForSeconds(wait));

            EventDispatch.Dispatch((int)EventID.GameEventId.HideAllEffect);
        }
예제 #7
0
        protected virtual void OnStartClick()
        {
            if (GameMove.IsStartRollJetton)
            {
                return;
            }
            EventDispatch.Dispatch((int)EventID.GameEventId.HideAllEffect);
            EventDispatch.Dispatch((int)EventID.GameEventId.ClearRoundScore);
            SFSObject data = SFSObject.NewInstance();

            data.PutInt(RequestKey.KeyType, (int)RequestCmd.CmdStartGame);
            data.PutInt("ante", PourTable.AnteTimes);
            App.GetRServer <LXGameServe>().SendGameRequest(data);
        }
예제 #8
0
        protected override void InitGameData(ISFSObject gameInfo)
        {
            base.InitGameData(gameInfo);
            _ante   = gameInfo.GetInt("ante");
            _caichi = gameInfo.GetLong("caichi");
            gameInfo.GetInt("hor");                      //横向有几个
            _line = gameInfo.GetInt("lines");            //总共有几条线
            _response.ShowLine = gameInfo.GetInt("ver"); //纵向有几个
            ISFSObject userInfo = gameInfo.GetSFSObject("user");

            _userGold = userInfo.GetLong("ttgold");
            _userCash = userInfo.GetInt("cash");
            EventDispatch.Dispatch((int)EventID.GameEventId.InitBottomPourData, new EventData(_ante, _line));
            EventDispatch.Dispatch((int)EventID.GameEventId.AlterPotGold, new EventData(_caichi));
        }
예제 #9
0
        /// <summary>
        /// 当图片停止时调用
        /// </summary>
        protected virtual void OnStopBySelf()
        {
            //发送更新彩池
            EventDispatch.Dispatch((int)EventID.GameEventId.ChangeButtonIcon, new EventData(3));
            Facade.Instance <MusicManager>().Stop();
            SFSObject sfsObject = SFSObject.NewInstance();

            sfsObject.PutInt(RequestKey.KeyType, (int)RequestCmd.CmdCaiChiChange);
            App.GetRServer <LXGameServe>().SendGameRequest(sfsObject);
            EventDispatch.Dispatch((int)EventID.GameEventId.ShowRedLineIfWin); //显示红线
            EventDispatch.Dispatch((int)EventID.GameEventId.AlterRoundScore);  //显示本局得分
            EventDispatch.Dispatch((int)EventID.GameEventId.PlayEffect);       //播放特效
            SFSObject data = SFSObject.NewInstance();

            data.PutInt(RequestKey.KeyType, (int)RequestCmd.CmdGetMessageWhenWin);
            App.GetRServer <LXGameServe>().SendGameRequest(data);//更新彩池
            OverallData gameData = App.GetGameData <OverallData>();

            gameData.GetPlayer().Coin = gameData.UserGold;
            gameData.GetPlayer().UpdateView();
            var isWin = App.GetGameData <OverallData>().Response.IsWin;

            //App.GetGameData<OverallData>().SetPlayerData();
            if (IsTrusteeship)
            {
                if (isWin)
                {
                    StartCoroutine(ReStartGameBySelf(5f));//中奖等4s
                }
                else
                {
                    StartCoroutine(ReStartGameBySelf(2f));//未中奖等2s
                }
                EventDispatch.Dispatch((int)EventID.GameEventId.ChangeButtonIcon, new EventData(2));
            }
            if (isWin)
            {
                StartCoroutine(HideAllEffectAfter(5f)); //自动隐藏特效
            }
            else
            {
                StartCoroutine(HideAllEffectAfter(2f)); //自动隐藏特效
            }
            CanQuit = true;
        }
예제 #10
0
 /// <summary>
 /// 每列最后阶段倒数几轮的滚动
 /// </summary>
 protected virtual void MoveLineIconInEnd(int num, int line)
 {
     if (EndRollNums[num] > 4)
     {
         for (int j = 0; j < AllChild[num].Count; j++)
         {
             if (AllChild[num][j].GetComponent <MoveJettonIcon>().Move(Speeds[line] * Time.deltaTime * _speedTimes))
             {
                 EndRollNums[num]--;
                 ResetJettonPos(num);
                 ChangeJettonOrder(AllChild[num]);
             }
         }
     }
     else if (EndRollNums[num] >= 1 && EndRollNums[num] <= 4)
     {
         for (int j = 0; j < AllChild[num].Count; j++)
         {
             if (AllChild[num][j].GetComponent <MoveJettonIcon>().Move(Speeds[line] * Time.deltaTime * _speedTimes))
             {
                 EndRollNums[num]--;
                 ResetJettonPos(num);
                 if (EndRollNums[num] != 0)
                 {
                     var _response = App.GetGameData <OverallData>().Response;
                     AllChild[num][0].GetComponent <UISprite>().spriteName = _response.GetJettonName(SpriteName);
                 }
                 else
                 {
                     ChangeJettonOrder(AllChild[num]);
                     if (num == HoldTimes.Length - 1)
                     {
                         InitData();
                         EventDispatch.Dispatch((int)EventID.GameEventId.WhenIconStop);
                     }
                 }
             }
         }
     }
 }
예제 #11
0
 public void OnExistGameTotHall()
 {
     Hide();
     EventDispatch.Dispatch((int)EventID.GameEventId.OnCloseBtnClick);
 }