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; }
private async void NavMain_OnSelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { NavigationViewItem nowitem = (NavigationViewItem)sender.SelectedItem; if (nowitem.Tag.ToString() == "PageMe" && !Common.Logined) { await DialogLogin.ShowAsync(); return; } switch (nowitem.Tag.ToString()) { case "PageMe": Common.BaseFrame.Navigate(typeof(Pages.Me), null, new EntranceNavigationTransitionInfo()); break; case "PageHome": Common.BaseFrame.Navigate(typeof(Pages.Home), null, new EntranceNavigationTransitionInfo()); break; case "PageSearch": Common.BaseFrame.Navigate(typeof(Search), null, new EntranceNavigationTransitionInfo()); break; case "PageSettings": Common.BaseFrame.Navigate(typeof(Pages.Settings), null, new EntranceNavigationTransitionInfo()); break; } }
private void InfoBarLoginHint_OnCloseButtonClick(InfoBar sender, object args) { if (Common.Logined) { DialogLogin.Hide(); } }
public static void Hide() { GameObject canvas = GameObject.Find("Canvas"); GameObject obj = canvas.transform.Find(DIALOG_NAME).gameObject; DialogLogin dlg = obj.GetComponent <DialogLogin>(); dlg.DoHide(obj); }
public static void Show(WorkDone cbGuest, WorkDone cbFS, WorkDone cbWechat) { GameObject canvas = GameObject.Find("Canvas"); GameObject obj = canvas.transform.Find(DIALOG_NAME).gameObject; DialogLogin dlg = obj.GetComponent <DialogLogin>(); dlg.DoShow(obj, cbGuest, cbFS, cbWechat); }
private async void NavMain_OnSelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { var nowitem = sender.SelectedItem as NavigationViewItem; if (!IsNavBack) { selectionHistory.Add(nowitem); } if (selectionHistory.Count > 1) { NavMain.IsBackEnabled = true; } IsNavBack = false; if (nowitem.Tag is null) { return; } if (nowitem.Tag.ToString() == "PersonalFM") { PersonalFM.InitPersonalFM(); return; } if (nowitem.Tag.ToString() == "PageMe" && !Common.Logined) { InfoBarLoginHint.IsOpen = true; await DialogLogin.ShowAsync(); return; } if (nowitem.Tag.ToString().StartsWith("Playlist")) { Common.BaseFrame.Navigate(typeof(Pages.SongListDetail), nowitem.Tag.ToString().Substring(8), new EntranceNavigationTransitionInfo()); } switch (nowitem.Tag.ToString()) { case "PageMe": Common.BaseFrame.Navigate(typeof(Pages.Me), null, new EntranceNavigationTransitionInfo()); break; case "PageHome": Common.BaseFrame.Navigate(typeof(Pages.Home), null, new EntranceNavigationTransitionInfo()); break; case "PageSettings": Common.BaseFrame.Navigate(typeof(Pages.Settings), null, new EntranceNavigationTransitionInfo()); break; } }
private void MainDialog_Load(object sender, EventArgs e) { DialogLogin loginDlg = new DialogLogin(); loginDlg.SettingConfigs = m_SettingConfigs; if (loginDlg.ShowDialog() != System.Windows.Forms.DialogResult.OK) { Environment.Exit(0); } this.Text = getCaption(loginDlg.apiSection.ApiElement.AppID); if (m_StockConfigs.load()) { foreach (KeyValuePair <string, string> kvce in m_StockConfigs.appConfigs) { SmpStock stock = new SmpStock(kvce.Key, kvce.Value); stock.Checked = true; lst_Stocks.Add(stock); } } if (m_NewsConfigs.load()) { foreach (KeyValuePair <string, string> kvce in m_NewsConfigs.appConfigs) { Links theNews = new Links(kvce.Key, kvce.Value); lst_News.Add(theNews); } } m_NewsPanel = new NewsPanel(lst_News); TabPage_News.Controls.Add(m_NewsPanel); m_StockPanel.InitData(lst_Stocks); m_UpdateTimer.Interval = 1000; m_UpdateTimer.Enabled = true; m_UpdateTimer.Tick += new EventHandler(UpdateTimer_Tick_EventHandler); m_UpdateTimer.Start(); m_SecondTimer.Interval = 1000; m_SecondTimer.Enabled = true; m_SecondTimer.Tick += new EventHandler(SecondTimer_Tick_EventHandler); m_SecondTimer.Start(); CfgManager.ReadConnectionStrings(); CfgManager.MapMachineConfiguration(); SNTPTime.calibrationTime(); m_HandleShowApi.BgWorkerCompleted += new EventHandler <BgWorkerEventArgs>(HandleShowApi_BgWorkerCompleted); }
void OnClick(GameObject sender) { Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton); if (sender.name == "BtnLogin") { if (m_cbFS != null) { m_cbFS(); } } else if (sender.name == "BtnClose") { // show login dialog DialogLogin.Show(m_cbGuest, m_cbFS, m_cbWechat); } string btnName = DialogName; GameObject btnObj = GameObject.Find(btnName); DoHide(btnObj); }
private async void LoginDone() { DialogLogin.Hide(); //加载我喜欢的歌 _ = Task.Run((() => { Common.Invoke((async() => { (bool isok, JObject js) = await Common.ncapi.RequestAsync(CloudMusicApiProviders.Likelist, new Dictionary <string, object>() { { "uid", Common.LoginedUser.id } }); Common.LikedSongs = js["ids"].ToObject <List <string> >(); })); })); _ = Task.Run((() => { Common.Invoke((async() => { //加载用户歌单 Microsoft.UI.Xaml.Controls.NavigationViewItem nowitem = NavItemsMyList; (bool isOk, JObject json) = await Common.ncapi.RequestAsync(CloudMusicApiProviders.UserPlaylist, new Dictionary <string, object>() { { "uid", Common.LoginedUser.id } }); if (isOk) { NavItemsLikeList.Visibility = Visibility.Visible; NavItemsMyList.Visibility = Visibility.Visible; Common.MySongLists.Clear(); foreach (JToken jToken in json["playlist"]) { if (jToken["subscribed"].ToString() == "True") { NavItemsLikeList.MenuItems.Add(new NavigationViewItem() { Content = jToken["name"].ToString(), Tag = "Playlist" + jToken["id"] }); } else { Common.MySongLists.Add(new NCPlayList() { cover = jToken["coverImgUrl"].ToString(), creater = new NCUser() { avatar = jToken["creator"]["avatarUrl"].ToString(), id = jToken["creator"]["userId"].ToString(), name = jToken["creator"]["nickname"].ToString(), signature = jToken["creator"]["signature"].ToString() }, plid = jToken["id"].ToString(), name = jToken["name"].ToString(), desc = jToken["description"].ToString() }); NavItemsMyList.MenuItems.Add(new NavigationViewItem() { Content = jToken["name"].ToString(), Tag = "Playlist" + jToken["id"] }); } } } })); })); // 执行签到操作 _ = Task.Run((() => { Common.Invoke((() => { Common.ncapi.RequestAsync(CloudMusicApiProviders.DailySignin); Common.ncapi.RequestAsync(CloudMusicApiProviders.DailySignin, new Dictionary <string, object>() { { "type", 1 } }); //刷播放量不? })); })); HyPlayList.OnMediaEnd += (hpi => { // 播放数据 _ = Task.Run((() => { Common.Invoke((() => { if (!hpi.isOnline) { return; } Common.ncapi.RequestAsync(CloudMusicApiProviders.Scrobble, new Dictionary <string, object>() { { "id", hpi.NcPlayItem.sid }, { "sourceid", "-1" } }); })); })); }); }
private void ButtonCloseLoginForm_Click(object sender, RoutedEventArgs e) { DialogLogin.Hide(); }
// Update is called once per frame void Update() { if (DialogLogin.Actived()) { return; } if (!m_net.IsRunning()) { // 主动结束了 return; } // Step m_net.CheckReconnect(); //if (m_net.CheckReconnect()) //{ //DebugConsole.Log("Door:Reconnect successful."); //CheckLogin(); //DialogBase.Hide(); //} if (m_rcCount > 3) { DialogWarning.Show("No Network!", "Your internet seems to be down.\nPlease check your network settings.", "Retry", "Exit", OnOK, OnCancel, OnOK); return; } ProtoPacket packet = new ProtoPacket(); if (m_net.RecvTryDequeue(ref packet)) { DebugConsole.Log("Door:Reception handle cmdId:" + packet.cmdId); switch (packet.cmdId) { case Constants.Dog_Login: { LoginResp loginResp = (LoginResp)packet.proto; Lobby.getInstance().UId = loginResp.UserId; DebugConsole.Log("UId:" + loginResp.UserId); m_login = true; // 登录成功,重定向 if (packet.callback != null) { // 重定向 packet.callback(); } } break; case Constants.Dog_Redirect: { RedirectResp rdResp = (RedirectResp)packet.proto; Lobby lobby = Lobby.getInstance(); lobby.Domain = rdResp.Domain; lobby.Port = rdResp.Port; lobby.Key = rdResp.Key; m_net.Close(); // 重定向到大厅 DebugConsole.Log("Door:Redirect to lobby:" + lobby.Domain + ":" + lobby.Port); StartCoroutine(LoadingScene()); } break; case Constants.Reconnect: { // 展示重连对话框,直到重连成功 if (packet.msgId == 1) { ProtoNet.WriteLog("Door:Reconnecting..."); // 3s后Display中重连 m_net.CheckReconnect(5); //DialogBase.Show("RECONNECT", "reconnecting"); GameObject.Find("RcText").GetComponent <Text>().text = "Reconnecting..."; m_net.Ip = "182.92.74.240"; m_rcCount++; } else if (packet.msgId == 2) { DebugConsole.Log("Door:Reconnect successful."); //DialogBase.Hide(); GameObject.Find("RcText").GetComponent <Text>().text = "Connect successfully."; // 启动默认登录 if (m_auto) { Login(Redirect); } } } break; case Constants.Error: { // 这里一定是登录错误? Status stat = (Status)packet.proto; string err = "Error:" + stat.Code.ToString() + "-" + stat.Desc; GameObject.Find("RcText").GetComponent <Text>().text = err; // 打开登录对话框 DialogLogin.Show(LoginAsGuest, LoginWithFsID, null); } break; default: { DebugConsole.Log("Door:Invalid cmdId:" + packet.cmdId); } break; } } //process = (int)(async.progress * 100); }