void Awake() { BindListenners(); Screen.sleepTimeout = SleepTimeout.NeverSleep; mainUI = GetComponent <UIPanel>().ui; createClubWindow = new CreateClubWindow(); createRoomWindow = new CreateRoomWindow(); joinWindow = new JoinWindow(); list = mainUI.GetChild("list").asCom; // 让茶楼和房间列表选项卡固定在用户选择的页面 var clubOrRoom = list.GetController("tab"); clubOrRoom.onChanged.Set(() => { PlayerPrefs.SetInt("clubOrRoom", clubOrRoom.selectedIndex); }); clubOrRoom.selectedIndex = PlayerPrefs.GetInt("clubOrRoom"); mainUI.GetChild("right").asCom.GetChild("btnCreateClub").onClick.Add(() => { createClubWindow.Show(); createClubWindow.position = new Vector3(); createClubWindow.width = mainUI.width; createClubWindow.height = mainUI.height; }); mainUI.GetChild("right").asCom.GetChild("btnCreateRoom").onClick.Add(() => { createRoomWindow.Show(); createRoomWindow.position = new Vector3(); createRoomWindow.width = mainUI.width; createRoomWindow.height = mainUI.height; }); mainUI.GetChild("right").asCom.GetChild("btnJoinRoom").onClick.Add(() => { PlayerPrefs.SetString("joinType", "room"); joinWindow.Show(); joinWindow.Center(); }); mainUI.GetChild("right").asCom.GetChild("btnJoinClub").onClick.Add(() => { PlayerPrefs.SetString("joinType", "club"); joinWindow.Show(); joinWindow.Center(); }); var footer = mainUI.GetChild("footer").asCom; footer.GetChild("btnHistory").onClick.Add(() => { SceneManager.LoadScene("History"); }); footer.GetChild("btnRule").onClick.Add(() => { MsgWindow msgWindow = new MsgWindow(); msgWindow.Show(); msgWindow.position = new Vector2(); msgWindow.width = mainUI.width; msgWindow.height = mainUI.height; msgWindow.SetTitle("游戏规则"); string rule = @"<b align='center'>牌型</b> <b>五小牛:</b>5张牌点数之和小于等于10 <b>炸弹:</b>有4张牌一样 <b>五花牛:</b>五张牌都是花牌(J/Q/K)组成 <b>牛牛:</b>五张牌中第一组三张牌和第一组二张牌之和分别为10的整数倍。如: 3/7/K/10/J <b>有牛:</b>五张牌中有三张的点数之和为10点的整数倍,并且另外两张牌之和与10进行取余,所得之数即为牛几。如: 2/8/J/6/3,即为牛9。 <b>无牛:</b>五张牌中没有任意三张牌点数之和为10的整数倍。例如: A/8/4/K/7 <b>牌型比较规则</b> <b>数字比较:</b>A>K>Q>J>10>9>8>7>6>5>4>3>2 <b>花色比较:</b>黑桃>红桃>梅花>方块 <b>牌型比较:</b>五小牛>炸弹>五花牛>牛牛>有牛>无牛 <b>无牛牌型比较:</b>取其中最大的一张牌比较大小,牌大的赢,大小相同比花色 <b>有牛牌型比较:</b>取其中最大的一张牌比较大小,牌大的赢,大小相同比花色 <b>炸弹之间大小比较:</b>取炸弹牌比较大小 <b>五小牛牌型比较:</b>庄吃闲 "; msgWindow.SetMsg(rule); }); footer.GetChild("btnMsg").onClick.Add(() => { Api.User.GetNotice(); }); footer.GetChild("btnShare").onClick.Add(() => { Api.User.GetShareText(); }); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); joinWindow = new JoinWindow(); joinWindow.Show(); }