コード例 #1
0
    private CreatRoomData DealCreatRoomData()
    {
        CreatRoomData data = new CreatRoomData();

        _choseList = new List <string>();
        string createGameInfo = "";
        var    toggles        = FindObjectsOfType <Toggle>();
        string name;

        if (toggles != null)
        {
            foreach (var toggle in toggles)
            {
                if (toggle.isOn)
                {
                    createGameInfo +=
                        toggle.gameObject.GetComponentInChildren <Text>().text;
                    _choseList.Add(toggle.gameObject.name);
                    name = toggle.gameObject.name;
                    SetCreatRoomState(data, name);
                }
            }
        }
        return(data);
    }
コード例 #2
0
    /// <summary>
    /// 自己进入房间
    /// </summary>
    /// <param name="list"></param>
    private void onSelfJoinRoom(ArrayList list, CreatRoomData info)
    {
        creatRoomInfo         = info;
        _playersInfo          = new PlayerInfo(creatRoomInfo.playerNum);
        _playersInfo.gameRule = (GameRule)creatRoomInfo.playState;
        _PlayerInfoList       = list;
        selfGameState         = SelfState.Join_room;

        if (creatRoomInfo.payState == (int)PayRule.AAPay || creatRoomInfo.payState == (int)PayRule.OnePay)
        {
            gameType = GameType.fangkaGame;
        }
        else if (creatRoomInfo.payState == (int)PayRule.MatchPay)
        {
            gameType = GameType.integarl;
        }
        if (!CheckIsHaveSelf(SelfInfo))//区分断线重连
        {
            _PlayerInfoList.Add(SelfInfo);
            _playersInfo.SelfJoinRoom(_PlayerInfoList);
            selfOrderIndex = _playersInfo.selfOrderIndex;
            // SceneManager.LoadScene("InGame");
            MainManager.Instance.dontDestroyOnLoad.StartLoadingScene("InGame", RoutineJoinAndExitGameRoom);
        }
        else
        {
            _playersInfo.SelfJoinRoom(_PlayerInfoList);
            selfOrderIndex = _playersInfo.selfOrderIndex;
            MainManager.Instance.dontDestroyOnLoad.StartLoadingScene("InGame", ReconnectionLoadGameSceneComplete);
        }
    }
コード例 #3
0
    /// <summary>
    /// 绑定在控件里,别删
    /// </summary>
    public void OnChangeCreatRoomInfo()
    {
        int           score = int.Parse(DiScore.text);
        CreatRoomData data  = DealCreatRoomData();

        data.baseScore = score;
        ShowConsuma(data);
        _creatRoomdata = data;
    }
コード例 #4
0
    private void ShowConsuma(CreatRoomData data)
    {
        int baseConsuma = 1;

        if (data.jushu == (int)GameTimes.Sixteen)
        {
            baseConsuma = 2;
        }

        if (data.payState == (int)PayRule.OnePay)
        {
            baseConsuma = baseConsuma * data.playerNum;
        }
        data.needMoney  = baseConsuma;
        consumeTxt.text = baseConsuma.ToString();
    }
コード例 #5
0
    public void Init()
    {
        voteState    = new Hashtable();
        selfRoomList = new List <CreatRoomData>();
        // gameType = GameType.fangkaGame;
        canNotPengMjList   = new List <Int64>();
        gangPaiState       = new Hashtable();
        creatRoomInfo      = new CreatRoomData();
        selfGameState      = SelfState.In_lobby;
        _PlayerInfoList    = new ArrayList();
        totleCardCountList = new Hashtable();
        totleCardCountList[PeopleNum.TwoPeople]   = 72;
        totleCardCountList[PeopleNum.ThreePeople] = 72;
        totleCardCountList[PeopleNum.FourPeople]  = 108;
        hupaiCompletePlayerHandcardSlist          = new List <HupaiPlayerInfo>();
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Hashtable>(EventId.OtherJoinRoom, OnOtherJoinRoom);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <ArrayList, CreatRoomData>(EventId.SelfJoinRoom, onSelfJoinRoom);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <KeyValuePair <string, Int64> >(EventId.PlaySitDown, OnPlayerSitDown);

        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64, Int64, ArrayList>(EventId.Server_HandCard, OnBeginGame);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64, Int64>(EventId.ShowLaizi, OnShowLaizi);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64>(EventId.Order, OnOrderHandle);

        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64>(EventId.AddOneCard, OnAddOneHandle);//第一次发牌,如果是自己的庄,则先收到自己摸的牌,再收到摸赖子消息
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64>(EventId.Server_draw, OnPlayerDrawCard);

        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64>(EventId.PlayCard, OnPlayPutOutCard);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64, Int64>(EventId.Server_PengCard, OnPengCard);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64, Int64, Int64>(EventId.Server_GangCard, OnGangCardHandle);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Hashtable>(EventId.Server_GangScore, OnGangScore);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <ArrayList, Int64, Int64>(EventId.Server_HuPai, OnHupai);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <ArrayList>(EventId.Server_HuPai_other_player_card, OnOtherPlayerCards);

        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Hashtable>(EventId.Server_HuScore, OnHuScore);
        EventDispatcher.GetInstance().UIFrameWorkEventManager.AddEventListener(EventId.UIFrameWork_Game_liuju, GameLiuJu);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <string>(EventId.PlayerExitRoom, OnPlayerExitRoom);
        EventDispatcher.GetInstance().UIFrameWorkEventManager.AddEventListener <int, int>(EventId.UIFrameWork_Game_Animation_Playover, OnAnimationPlayover);
        EventDispatcher.GetInstance().UIFrameWorkEventManager.AddEventListener(EventId.Server_End_Game, OnEndGame);
        EventDispatcher.GetInstance().UIFrameWorkEventManager.AddEventListener(EventId.Server_Disband_Eng_Game, OnDisbandEndGame);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <ReconnectionData>(EventId.Sever_Reconnection, OnReconnection);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <ArrayList>(EventId.Sever_Reconnection_SelfHandcard, OnReconnectionSelfHandcard);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Int64>(EventId.Sever_Reconnection_selfMopai_Num, OnReconnectionSelfMopaiNum);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Hashtable>(EventId.Server_Room_list, OnChangRoomList);

        EventDispatcher.GetInstance().MainEventManager.AddEventListener <string, Int64>(EventId.Server_Disband_Game_Vote, OnDisbandgame);
        EventDispatcher.GetInstance().MainEventManager.AddEventListener <Hashtable>(EventId.Server_Disband_Room_Vote_list, OnReconnectionDisbandList);
    }
コード例 #6
0
    private void ShowRoomRuleInfo()
    {
        List<string>  playRuleList = new List<string> { "无癞", "半癞", "一脚癞油", "油上油" };
        CreatRoomData data = TableController.Instance.creatRoomInfo;
        string times = TableController.Instance.playCount.ToString() + "/" + TableController.Instance.creatRoomInfo.jushu.ToString();
        roomIDTxt.text = SocketClient.Instance.roomID.ToString();
        baseScoreTxt.text = TableController.Instance.creatRoomInfo.baseScore.ToString();
        countTxt.text = times;
    //    playRuleTxt.text = data.playerNum+"人/"+playRuleList[TableController.Instance.creatRoomInfo.playState - 1];
        
        DateTime dt = DateTime.Parse(DateTime.UtcNow.ToString("1970-01-01 00:00:00")).AddMilliseconds(data.roomBeginTime);
        DateTime localdt = dt.ToLocalTime();
        string result = localdt.ToString("yyyy-MM-dd HH:mm");
        beginTxt.text = result;


    }
コード例 #7
0
        public void on_enter_mj_huanghuang_room(ArrayList data)
        {
            ArrayList list      = (ArrayList)data[0];
            Int64     peopleNum = (Int64)data[1];
            // Int64 rule = (Int64)data[2];
            Int64         score         = (Int64)data[2];
            Int64         times         = (Int64)data[3];
            Int64         payRule       = (Int64)data[4];
            Int64         beginTime     = (Int64)data[5];
            CreatRoomData creatRoomInfo = new CreatRoomData();

            creatRoomInfo.playerNum = (int)peopleNum;
            //  creatRoomInfo.playState = (int)rule;
            creatRoomInfo.baseScore     = (int)score;
            creatRoomInfo.jushu         = (int)times;
            creatRoomInfo.payState      = (int)payRule;
            creatRoomInfo.roomBeginTime = beginTime;
            EventDispatcher.GetInstance().MainEventManager.TriggerEvent <ArrayList, CreatRoomData>(EventId.SelfJoinRoom, list, creatRoomInfo);
        }
コード例 #8
0
    private void SetCreatRoomState(CreatRoomData data, string name)
    {
        int           index;
        List <string> strlist = new List <string> {
            "playerNum", "playState", "jushu", "payState"
        };
        string     str;
        List <int> scoreList = new List <int> {
            8, 16
        };

        for (int i = 0; i < strlist.Count; i++)
        {
            str   = strlist[i];
            index = name.IndexOf(str);
            if (index >= 0)
            {
                switch (str)
                {
                case "playerNum":
                    data.playerNum = int.Parse(name.Replace(str, ""));
                    break;

                case "playState":
                    data.playState = int.Parse(name.Replace(str, ""));
                    break;

                case "jushu":
                    data.jushu = scoreList[int.Parse(name.Replace(str, ""))];
                    break;

                case "payState":
                    data.payState = int.Parse(name.Replace(str, ""));
                    break;

                default:
                    break;
                }
                break;
            }
        }
    }
コード例 #9
0
    private void OnChangRoomList(Hashtable table)
    {
        Hashtable     value;
        CreatRoomData roomInfo;

        // List<string> playerNum = new List<string> { "对窝子", "戳虾子", "晃晃" };
        selfRoomList.Clear();
        foreach (string item in table.Keys)
        {
            roomInfo                  = new CreatRoomData();
            value                     = (Hashtable)table[item];
            roomInfo.roomID           = item;
            roomInfo.playerNum        = (int)(Int64)value["peopleNum"];
            roomInfo.currentPlayerNum = (Int64)value["playerNum"];
            roomInfo.playState        = (int)(Int64)value["gameRule"];
            roomInfo.baseScore        = (int)(Int64)value["gameScore"];
            roomInfo.jushu            = (int)(Int64)value["gameTimes"];
            selfRoomList.Add(roomInfo);
        }

        EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent(EventId.UIFrameWork_Room_List_Change);
        Debug.Log(table.Count);
    }