void Start() { //StartCoroutine(LoadingScene()); // Login first m_login = false; // 初始化ProtoNet m_net = new ProtoNet(); // 增加前台支持的网络包类型 m_net.Add(Constants.Dog_Login, LoginResp.Parser); m_net.Add(Constants.Dog_Redirect, RedirectResp.Parser); m_net.Add(Constants.Error, Status.Parser); m_net.Name = "Door"; m_net.Init("182.92.74.240", 7900); GameObject.Find("RcText").GetComponent <Text>().text = "Loading..."; //string myUID = SystemInfo.deviceUniqueIdentifier; //DialogBase.Show("UID", myUID); if (GlobalVars.instance.Testing || GlobalVars.instance.SwitchUser) { m_auto = false; DialogLogin.Show(LoginAsGuest, LoginWithFsID, null); } else { m_auto = true; } GlobalVars.instance.SwitchUser = false; }
// Use this for initialization void Start() { m_spinCount = 0; m_tigerNo = 888; m_seqNo = 666; m_gold = 0; m_net = new ProtoNet(); // 增加前台支持的网络包类型 m_net.Add(Constants.Tiger_QuickLoginInfo, TigerUserInfo.Parser); m_net.Add(Constants.Tiger_Spin, TigerResp.Parser); m_net.Add(Constants.Reconnect, null); m_net.Add(Constants.Error, null); m_net.Name = "SlotClerk"; m_login = false; m_lines = 1; m_win = 0; // 启动登录 RedirectResp rr = Lobby.getInstance().RedirectInfo; m_id = rr.UserId; m_key = rr.Key; if (false == m_net.Init(rr.Domain, rr.Port)) { DebugConsole.Log("Client init failed!"); } /* * m_id = 123456; * m_key = 123456; * // 启动登录 * if (false == m_net.Init("127.0.0.1", 1234)) * { * DebugConsole.Log("Client init failed!"); * } */ // 初始化Displays //m_displays = new SlotClientDisplays(); // MonoBehaviour不可以new m_displays = GameObject.Find("SlotDisplays").GetComponent <SlotDisplays>(); m_displays.User = this; // 初始化Requests m_requests = new SlotRequests(); m_requests.Net = m_net; m_requests.Clerk = this; // 发送快速登录 m_requests.QuickLogin(); }
// Use this for initialization void Start() { // 初始化ProtoNet if (m_net == null) { m_login = false; m_net = new ProtoNet(); // 增加前台支持的网络包类型 m_net.Add(Constants.Lion_QuickLoginInfo, LionUserInfo.Parser); m_net.Add(Constants.Lion_Redirect, RedirectResp.Parser); m_net.Add(Constants.Lion_GetProfile, LionUserInfo.Parser); m_net.Add(Constants.Lion_UpdateProfile, Status.Parser); m_net.Add(Constants.Lion_GetTigerStat, TigerStat.Parser); m_net.Add(Constants.Lion_GetFriends, LongArray.Parser); m_net.Add(Constants.Lion_GetFriendRequests, LongArray.Parser); m_net.Add(Constants.Lion_AddFriend, Status.Parser); m_net.Add(Constants.Lion_DeleteFriend, Status.Parser); m_net.Add(Constants.Lion_AcceptFriend, Status.Parser); m_net.Add(Constants.Lion_IgnoreFriend, Status.Parser); m_net.Add(Constants.Lion_GetFriendSummary, FriendSummaryList.Parser); m_net.Add(Constants.Lion_NotifyWeeklyLogin, IntValue.Parser); m_net.Add(Constants.Lion_TakeLoginBonus, LongArray.Parser); m_net.Add(Constants.Lion_NotifyFreeBonus, LongValue.Parser); m_net.Add(Constants.Lion_TakeFreeBonus, LongArray.Parser); m_net.Add(Constants.Lion_BuyItem, Status.Parser); m_net.Add(Constants.Lion_GetItems, UserItemList.Parser); m_net.Add(Constants.Lion_Register, Status.Parser); m_net.Add(Constants.Lion_ModPass, Status.Parser); m_net.Add(Constants.Lion_RefreshGold, LongValue.Parser); m_net.Add(Constants.Lion_GetShopItems, ShopList.Parser); m_net.Add(Constants.Lion_BroadcastSystemMessage, StringValue.Parser); m_net.Add(-2, null); m_net.Add(Constants.Reconnect, null); m_net.Add(Constants.Error, Status.Parser); m_net.Name = "Reception"; } if (!m_login) { // 启动登录 Lobby lobby = Lobby.getInstance(); DebugConsole.Log("Loading start:" + lobby.Domain); if (lobby.Domain == "") { SceneManager.LoadSceneAsync("sloading"); } else { DebugConsole.Log("Loading start2:" + lobby.Domain); if (false == m_net.Init(lobby.Domain, lobby.Port)) { // 这里不重连,在发送请求失败后再重连 DebugConsole.Log("Reception:Client init failed!"); } QuickLogin(); } } else { UpdateUserInfoUI(); } // 刷新倒计时 UpdateCountDown(); for (int i = 0; i < Constants.LobbyBtn_Strings.Length; ++i) { string btnName = Constants.LobbyBtn_Strings[i]; m_btnIndexDict.Add(btnName, i); GameObject btnObj = GameObject.Find(btnName); Button btn = btnObj.GetComponent <Button>(); btn.onClick.AddListener(delegate() { this.OnClick(btnObj); }); } }