private void OnClickGameLevelCallback(int gameLevelId, Transform container) { AppDebug.Log(gameLevelId); m_levelDetailView = WindowUIMgr.Instance.OpenWindow(WindowUIType.GameLevelDetail).GetComponent <UIGameLevelDetailView>(); //GameObject @object = ResourcesMgr.Instance.Load(ResourcesMgr.ResourceType.UIWindow, "Pan_GameLevelDetail"); m_levelDetailView.transform.SetParent(container); m_levelDetailView.gameObject.SetGameObjNormalTransfor(0.8f); SetGameLevelDetailData(gameLevelId, 0, m_levelDetailView); }
/// <summary> /// 服务器广播比赛开始 /// </summary> /// <param name="obj"></param> private void OnServerBroadcastBegin(byte[] obj) { AppDebug.Log("服务器广播比赛开始"); OP_MATCH_BEGIN proto = OP_MATCH_BEGIN.decode(obj); MatchProxy.Instance.BeginMatch(); GameCtrl.Instance.BeginMatch(m_CurrentSelectMatchEntity.gameId); MatchProxy.Instance.UpdateRiseCount(proto.promoted); m_isWait = false; }
protected void Application_End(Object sender, EventArgs e) { AppDebug.LogEvent("[DealingConsole]", "Application_End", EventLogEntryType.Information); string serviceUrl = this.GetLocalServiceUrl(); this.StateServer.UnRegister(new Token(Guid.Empty, UserType.System, AppType.DealingConsole), serviceUrl); AppDebug.LogEvent("DealingConsole", "DealingConsole stopped", EventLogEntryType.SuccessAudit); }
protected void Application_Start(Object sender, EventArgs e) { try { AppDebug.LogEvent("DealingConsole", "Application_Start", EventLogEntryType.Information); //Used for kickout--Michael this.Context.Application["SessionIDs"] = new Hashtable(); this.Context.Application["IsRegistered"] = false; this.Context.Application["Commands"] = new Commands(new TimeSpan(0, 10, 0).TotalMilliseconds); this.Context.Application["Tokens"] = new Hashtable(); StateServerService stateServer = new StateServerService(); this.StateServerReadyCheck(stateServer); this.Context.Application["StateServer"] = stateServer; ParticipantServices.ParticipantServices participantServices = new ParticipantServices.ParticipantServices(); Application["ParticipantServices"] = participantServices; SecurityServices.SecurityServices securityServices = new SecurityServices.SecurityServices(); Application["SecurityServices"] = securityServices; // this.Context.Application["IsRegistered"]=false; // this.Context.Application["Commands"]=null; // this.Context.Application["Tokens"]=new Hashtable(); //// this.Context.Application["Sessions"]=new Hashtable(); // // StateServer.Service stateServer=new StateServer.Service(); // this.Context.Application["StateServer"]=stateServer; // int commandSequence; Token token = new Token(Guid.Empty, UserType.System, AppType.DealingConsoleServer); DataSet dataSet = stateServer.GetInitData(token, null, out commandSequence); string connectionString = ConfigurationSettings.AppSettings["ConnectionString"]; DealingConsoleServer dealingConsoleServer = new DealingConsoleServer(connectionString); dealingConsoleServer.Init(dataSet); this.Context.Application["DealingConsoleServer"] = dealingConsoleServer; AppDebug.LogEvent("DealingConsole", "DealingConsole started", EventLogEntryType.SuccessAudit); } catch (Exception exception) { AppDebug.LogEvent("DealingConsole", exception.ToString(), EventLogEntryType.Error); } // // //#if (PERMISSION) // ParticipantServices.ParticipantServices participantServices = new ParticipantServices.ParticipantServices(); // Application["ParticipantServices"] = participantServices; // SecurityServices.SecurityServices securityServices = new SecurityServices.SecurityServices(); // Application["SecurityServices"] = securityServices; //#endif }
/// <summary> /// 服务器广播换庄 /// </summary> private void OnServerChooseBanker(byte[] obj) { AppDebug.Log("服务器广播换庄"); JY_ROOM_INFORMBANKER proto = JY_ROOM_INFORMBANKER.decode(obj); RoomJuYouProxy.Instance.OnServerChooseBanker(proto); //if (PaiJiuSceneCtrl.Instance != null) //{ // PaiJiuSceneCtrl.Instance.ChooseBanker(); //} }
private IEnumerator LoadingScene() { string strSceneName = string.Empty; switch (SceneMgr.Instance.CurrentSceneType) { case SceneType.LogOn: strSceneName = "Scene_LogOn"; break; case SceneType.SelectRole: strSceneName = "Scene_SelectRole"; break; case SceneType.WorldMap: //现在需要根据当前服务器返回的最后登录的世界地图id拿到地图相关实体数据 WorldMapEntity worldMapEntity = WorldMapDBModel.GetInstance.GetEntityById(SceneMgr.Instance.CurrWorldMapId); if (worldMapEntity != null) { //现在我们从地图实体类中找到我们地图编号对应的场景名字 strSceneName = worldMapEntity.SceneName; } else { AppDebug.Log(GetType() + "/LoadingScene()/当前世界地图id没有得到对应的实体数据,请检查。id = " + SceneMgr.Instance.CurrWorldMapId); strSceneName = string.Empty; } break; } //说明有错误需要调整 if (strSceneName == string.Empty) { //直接退出携程 yield break; } if (SceneMgr.Instance.CurrentSceneType == SceneType.SelectRole || SceneMgr.Instance.CurrentSceneType == SceneType.WorldMap) { AssetBundleMgr.Instance.LoadAssetAsync(string.Format("Scene/{0}.unity3d", strSceneName), strSceneName, OnLoadABCompleted: (UnityEngine.GameObject obj) => { m_Async = SceneManager.LoadSceneAsync(strSceneName, LoadSceneMode.Additive); m_Async.allowSceneActivation = false; }); } else { m_Async = SceneManager.LoadSceneAsync(strSceneName, LoadSceneMode.Additive); m_Async.allowSceneActivation = false; yield return(m_Async); } }
/// <summary> /// 设置UI手牌 状态 /// </summary> public void SetHandPokerStatus(Seat seat) { AppDebug.Log(string.Format("翻开UI手牌")); for (int i = 0; i < m_HandList.Count; i++) { if (m_HandList[i].Majiang != null) { m_HandList[i].Majiang.SetPokerStatus(true); } } }
/// <summary> /// Отобразить таблицу лидеров /// </summary> public void OnShowLeaderBoard() { try { ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(LEADERBOARD); } catch (Exception ex) { AppDebug.Error(ex.Message); } }
public GameObject Load(ResourceType type, string name, bool isCache = true, bool isInstantiate = true) { GameObject go = null; string path = ""; switch (type) { case ResourceType.UIScene: path += "UIScenes/"; break; case ResourceType.UIWindow: path += "UIWindows/"; break; case ResourceType.Prefab: path += "Prefabs/"; break; case ResourceType.UIItem: path += "UIItems/"; break; case ResourceType.UIAnimation: path += "UIAnimations/"; break; } path += name; if (m_pDictionary.ContainsKey(path)) { go = m_pDictionary[path]; } else { go = Resources.Load <GameObject>(path); if (go == null) { AppDebug.LogWarning("资源" + path + "为空"); return(null); } if (isCache) { m_pDictionary.Add(path, go); } } if (isInstantiate) { return(Object.Instantiate(go)); } else { return(go); } }
private void Start() { try { _lvl = int.Parse(this.GetComponentInChildren <Text>().text); } catch (Exception ex) { AppDebug.Error(ex.Message); } }
/// <summary> /// 服务器广播选庄 /// </summary> private void OnServerChooseBanker(byte[] obj) { AppDebug.Log("服务器广播选庄"); PAIGOW_ROOM_CHOOSEBANKER proto = PAIGOW_ROOM_CHOOSEBANKER.decode(obj); RoomPaiJiuProxy.Instance.OnServerChooseBanker(proto); if (PaiJiuSceneCtrl.Instance != null) { PaiJiuSceneCtrl.Instance.ChooseBanker(); } }
/// <summary> /// 打牌 /// </summary> /// <returns></returns> public MaJiangCtrl PlayMaJiang(int seatPos, Poker poker, bool isReplay = false) { //从手牌里找牌 MaJiangCtrl majiang = null; if (m_DicHand.ContainsKey(seatPos)) { List <MaJiangCtrl> lst = m_DicHand[seatPos]; if (poker.color == 0) { AppDebug.ThrowError("生成了一张空牌 3:" + poker.ToLog()); } for (int i = 0; i < lst.Count; ++i) { if (lst[i].Poker.index == poker.index) { majiang = lst[i]; lst.RemoveAt(i); break; } } Sort(lst, RoomMaJiangProxy.Instance.GetSeatBySeatId(seatPos).UniversalList); } if (majiang == null) { string str = string.Format("没找到要打的牌!!!!!!{0}", poker.ToString("{0}_{1}_{2}_{3}")); AppDebug.ThrowError(str); } MaJiangCtrl ctrl = SpawnMaJiang(seatPos, poker, "Table"); if (majiang != null) { ctrl.transform.position = majiang.transform.position; ctrl.transform.rotation = majiang.transform.rotation; DespawnMaJiang(majiang); } if (!m_DicTable.ContainsKey(seatPos)) { m_DicTable.Add(seatPos, new List <MaJiangCtrl>()); } m_DicTable[seatPos].Add(ctrl); if (ctrl.Poker == null || ctrl.Poker.color == 0) { AppDebug.ThrowError("生成了一张空牌"); } return(ctrl); }
/// <summary> /// 截屏完成回调 /// </summary> /// <param name="tex"></param> private void OnScreenCaptureComplete(Texture2D tex) { string path = LocalFileManager.Instance.LocalFilePath + "share/"; if (!IOUtil.DirectoryExists(path)) { IOUtil.CreateDirectory(path); } IOUtil.Write(path + "record.jpg", tex.EncodeToJPG()); AppDebug.Log("分享完了啊"); ShareCtrl.Instance.ShareTexture(WXShareType.WXSceneSession, path + "record.jpg"); }
/// <summary> /// 进入房间 /// </summary> /// <param name="pbSeat"></param> public void EnterRoom(NN_ROOM_ENTER proto) { NiuNiu.Seat seat = GetSeatBySeatPos(proto.pos); if (seat == null) { Debug.Log("新玩家进入房间,找不到对应座位"); } if (seat == null) { return; } seat.Avatar = proto.avatar; seat.PlayerId = proto.playerId; seat.IsReady = CurrentRoom.currentLoop == 0 ? false : true; seat.Nickname = proto.nickname; seat.Gender = proto.gender; seat.Gold = proto.gold; seat.IsBanker = proto.isBanker; if (proto.hasIsHomeowners()) { seat.IsHomeowners = proto.IsHomeowners; } seat.Pos = proto.pos; //纬度 if (proto.hasLatitude()) { seat.Latitude = proto.latitude; } //经度 if (proto.hasLongitude()) { seat.Longitude = proto.longitude; } Debug.Log(string.Format("新加入的玩家名字:{0} 服务器发送{1} ", seat.Nickname, proto.nickname)); AppDebug.Log(seat.Nickname + "进入房间"); PeopleCounting();//计算人数 //显示UI //TransferData data = new TransferData(); //data.SetValue("Seat", seat); //data.SetValue("RoomStatus", CurrentRoom.roomStatus); //SendNotification("AddJoinItemUI", data); // SetInteractionOnOff();//设置交互显影 SendRoomInfoChangeNotify(); }
/// <summary> /// 服务器广播总结算信息 /// </summary> /// <param name="obj"></param> private void OnServerResultInfo(byte[] obj) { AppDebug.Log("服务器广播总结算信息"); PAIGOW_ROOM_TOTALSETTLE proto = PAIGOW_ROOM_TOTALSETTLE.decode(obj); if (proto.hasPaigowRoom()) { m_Result = proto.paigow_room; RoomPaiJiuProxy.Instance.RoomResult(m_Result); } }
/// <summary> /// 托管 /// </summary> public void Trustee(int playerId, bool isTrustee) { SeatEntity seat = GetSeatByPlayerId(playerId); if (seat == null) { return; } seat.IsTrustee = isTrustee; SendSeatInfoChangeNotify(seat); AppDebug.Log(seat.Nickname + "托管"); }
public void BrodcastMinuteChartDataCommand(Token token, MinuteChartData[] minuteChartDatas) { try { Global.StateServer.BrodcastMinuteChartDataCommand(token, minuteChartDatas); } catch (Exception ex) { AppDebug.LogEvent("ManagerCallback.BrodcastMinuteChartDataCommand", string.Format("BrodcastMinuteChartDataCommand:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error); } }
public void BrodcastTradingDailyQuotations(Token token, List <InstrumentDailyClosePriceInfo> closeQuotations) { try { Global.StateServer.SetDailyClosePrices(token, closeQuotations); } catch (Exception ex) { AppDebug.LogEvent("ManagerCallback.SetDailyClosePrices", string.Format("SetDailyClosePrices:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error); } }
public void BrodcastTradingDailyQuotation(Token token, Guid instrumentId, DateTime tradeDay, List <TradingDailyQuotation> closeQuotations) { try { Global.StateServer.SetDailyClosePrice(token, instrumentId, tradeDay, closeQuotations); } catch (Exception ex) { AppDebug.LogEvent("ManagerCallback.SetDailyClosePrice", string.Format("SetDailyClosePrice:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error); } }
private void Timer_Tick(object sender, object e) { try { // Get time for usage TimeSpan timePassed = DateTime.Now.Subtract(UsageContext.Usage.StartTime); Duration.Text = $"Duration: {new DateTime(timePassed.Ticks).ToString("HH:mm:ss")}"; } catch (Exception x2) { AppDebug.Exception(x2, "Timer_Tick"); } }
public void ResetHit(Token token, Guid[] orderIds) { try { Global.StateServer.ResetHit(token, orderIds); } catch (Exception ex) { AppDebug.LogEvent("ManagerCallback.ResetHit", string.Format("ResetHit:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error); } }
public void BroadcastQuotation(Token token, OriginQuotation[] originQs, OverridedQuotation[] overridedQs) { try { Global.StateServer.Broadcast(token, originQs, overridedQs); } catch (Exception ex) { AppDebug.LogEvent("ManagerCallback.BroadcastQuotation", string.Format("udpateNode:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error); } }
/// <summary> /// 牌局结果界面分享按钮点击 /// </summary> /// <param name="obj"></param> private void OnBtnResultViewShareClick(object[] obj) { if (m_UIResultView != null) { m_UIResultView.StartCoroutine(ShareCtrl.Instance.ScreenCapture(OnScreenCaptureComplete)); } else if (m_UISettleView != null) { AppDebug.Log("开始分享了啊"); m_UISettleView.StartCoroutine(ShareCtrl.Instance.ScreenCapture(OnScreenCaptureComplete)); } }
private async void SubmitFeedback(object sender, TappedRoutedEventArgs e) // Send feedback to server { HttpResponseMessage res = null; UsageUpdateRequest req; double[] ranks = new double[4]; ranks = GetRanks(questionDictionary); try { // Build request for server progressRing.IsActive = true; GlobalContext.CurrentUser.UsageSessions.LastOrDefault().usageFeedback = questionDictionary; UsageData use = GlobalContext.CurrentUser.UsageSessions.LastOrDefault(); string userId = GlobalContext.CurrentUser.Data.UserID; req = new UsageUpdateRequest(use.UsageStrain.Name, use.UsageStrain.ID, userId, ((DateTimeOffset)use.StartTime).ToUnixTimeMilliseconds(), ((DateTimeOffset)use.EndTime).ToUnixTimeMilliseconds(), ranks[0], ranks[1], ranks[2], use.HeartRateMax, use.HeartRateMin, (int)use.HeartRateAverage, ranks[3], questionDictionary); res = await HttpManager.Manager.Post(Constants.MakeUrl("usage"), req); // Send request if (res != null) { // Request sent successfully if (res.IsSuccessStatusCode) { Status.Text = "Usage update Successful!"; var index = GlobalContext.CurrentUser.UsageSessions.Count - 1; GlobalContext.CurrentUser.UsageSessions[index].UsageId = res.GetContent()["body"]; PagesUtilities.SleepSeconds(0.5); Frame.Navigate(typeof(DashboardPage)); } else { Status.Text = "Usage update failed! Status = " + res.StatusCode; } } else { Status.Text = "Usage update failed!\nPost operation failed"; } Frame.Navigate(typeof(DashboardPage)); } catch (Exception x) { AppDebug.Exception(x, "UsageUpdate"); } }
/// <summary> /// 从网络下载 /// </summary> /// <param name="avatarUrl"></param> /// <param name="isCache"></param> /// <returns></returns> private IEnumerator LoadHeadCoroutine(string avatarUrl, bool isCache) { LogSystem.Log("下载图片:" + avatarUrl); WWW www = new WWW(avatarUrl + "?t=" + TimeUtil.GetTimestampMS().ToString()); float timeOut = Time.time; float progress = www.progress; while (www != null && !www.isDone) { if (progress < www.progress) { timeOut = Time.time; progress = www.progress; } if (Time.time - timeOut > DownloadManager.DOWNLOAD_TIME_OUT) { www.Dispose(); AppDebug.LogWarning("下载超时"); LoadHead(avatarUrl, isCache); yield break; } yield return(null); } yield return(www); if (www.error == null) { int hash = avatarUrl.GetHashCode(); if (isCache) { if (!IOUtil.DirectoryExists(CACHE_PATH)) { IOUtil.CreateDirectory(CACHE_PATH); } IOUtil.Write(CACHE_PATH + hash.ToString(), www.bytes); } if (!m_TextureDic.ContainsKey(hash)) { m_TextureDic.Add(hash, www.texture); } if (m_LoadingDic.ContainsKey(hash) && m_LoadingDic[hash] != null) { m_LoadingDic[hash](m_TextureDic[hash]); m_LoadingDic.Remove(hash); } www.Dispose(); } yield return(null); }
public bool ResetServerAndKickoffAllTrader(Token token, int timeout) { try { return(Global.StateServer.ResetServerAndKickoffAllTrader(token, timeout)); } catch (Exception ex) { AppDebug.LogEvent("ManagerCallback.ResetServerAndKickoffAllTrader", string.Format("{0}", ex), EventLogEntryType.Error); return(false); } }
/// <summary> /// 服务器广播游戏结束 /// </summary> /// <param name="obj"></param> private void OnServerGameOver(byte[] obj) { AppDebug.Log("服务器广播游戏结束"); if (JuYouSceneCtrl.Instance != null) { JuYouSceneCtrl.Instance.GameOver(); } //SeeResult(); }
private bool InnerLoginAndAuthenticate(string userName, string password, ExchangeSystem exchangeSystem, bool authenticateOnly, out Guid userID, out string errorMsg) { try { ParticipantServices.ParticipantServices participantServices = (ParticipantServices.ParticipantServices)Application["ParticipantServices"]; userID = participantServices.Login(userName, password); if (userID == Guid.Empty) { errorMsg = "User name not exists or password is invalid."; return(false); } SecurityServices.SecurityServices securityServices = (SecurityServices.SecurityServices)Application["SecurityServices"]; Guid programID = new Guid(ConfigurationSettings.AppSettings["DealingConsole"]); Guid permissionID = new Guid(ConfigurationSettings.AppSettings["Run"]); bool isAuthrized = securityServices.CheckPermission(userID, programID, permissionID, "", "", userID, out errorMsg); if (isAuthrized == false) { userID = Guid.Empty; return(false); } Token token = new Token(userID, UserType.System, AppType.DealingConsole); token.SessionID = this.Context.Session.SessionID; token.ExchangeSystem = exchangeSystem; this.Session["Token"] = token; bool success = this.StateServer.Login(token); if (success == false) { userID = Guid.Empty; errorMsg = "Login to stateServer failure."; return(false); } if (!authenticateOnly) { FormsAuthentication.SetAuthCookie(userID.ToString(), false); //Prevent be kickout Hashtable sessionIDs = (Hashtable)this.Context.Application["SessionIDs"]; sessionIDs = Hashtable.Synchronized(sessionIDs); sessionIDs[userID] = this.Context.Session.SessionID; } return(true); } catch (Exception exception) { AppDebug.LogEvent("DealingConsole", exception.ToString(), EventLogEntryType.Error); throw; } }
private void Awake() { try { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build(); PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.Activate(); } catch (Exception ex) { AppDebug.Error(ex.Message); } }
public static void SetParent(this GameObject obj, Transform parent, bool isUI = false) { if (parent == null) { AppDebug.LogWarning("设置的父节点为空!请检查引用对象"); return; } obj.transform.SetParent(parent, !isUI); obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; obj.transform.localEulerAngles = Vector3.zero; //obj.SetLayer(parent.gameObject.layer); }