internal void HandleArenaStartChallenge(ulong guid, ulong target_guid) { LogSys.Log(LOG_TYPE.DEBUG, "---got start challenge result msg! id=" + guid); UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid); if (user == null) { return; } ArenaInfo target_arena_info = m_ArenaSystem.GetArenaInfoById(target_guid); JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaStartChallengeResult); resultMsg.m_Guid = guid; ArkCrossEngineMessage.Msg_LC_ArenaStartCallengeResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaStartCallengeResult(); protoData.m_TargetGuid = target_guid; protoData.m_Sign = new Random().Next(); if (target_arena_info != null && target_arena_info.IsNeedUpdate(user)) { target_arena_info.UpdateArenaInfo(user); } bool start_ret = m_ArenaSystem.StartChallenge(guid, target_guid, protoData.m_Sign); if (target_arena_info == null) { protoData.m_ResultCode = (int)GeneralOperationResult.LC_Failure_Arena_NotFindTarget; } else if (!start_ret) { protoData.m_ResultCode = (int)m_ArenaSystem.ErrorCode; } else { user.UpdateGuideFlag((int)MatchSceneEnum.Arena); user.CurrentState = UserState.Pve; protoData.m_ResultCode = (int)GeneralOperationResult.LC_Succeed; ChallengeInfo challenge = m_ArenaSystem.GetDoingChallengeInfo(guid); if (challenge != null && challenge.Target != null) { float coefficent = ChallengeChecker.CalcPvpCoefficient(user.Level, target_arena_info.Level); int total_hp = ChallengeChecker.CalcPlayerHp(target_arena_info, coefficent); challenge.Target.TotalHp = total_hp; //LogSys.Log(LOG_TYPE.DEBUG, "challenge target totalhp={0}", total_hp); } } resultMsg.m_ProtoData = protoData; JsonMessageDispatcher.SendDcoreMessage(user.NodeName, resultMsg); LogSys.Log(LOG_TYPE.DEBUG, "---send start challenge result msg! id=" + guid); }
public ChallengeInfo GetChallengeByCompanyID(int companyID) { ChallengeInfo cha = new ChallengeInfo(); SqlParameter parm = new SqlParameter(PARM_COMPANY_ID, SqlDbType.Int); parm.Value = companyID; using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.Text, SQL_SELECT_CHALLENGE, parm)) { if (rdr.Read()) { int temp = rdr.GetInt32(0); } } return(cha); }
// Use this for initialization void Start() { //generate first 3 random challenges if (!firstChallenge) { Debug.Log("Please assign all the variables"); } int RandomInt = Random.Range(0, challenges.Length); GameObject initObj; lastChallenge = firstChallenge.GetComponent <ChallengeInfo>(); for (int i = 0; i < 3; i++) { RandomInt = Random.Range(0, challenges.Length); initObj = Instantiate(challenges[RandomInt], lastChallenge.GetEndPos(), Quaternion.identity) as GameObject; initObj.transform.parent = transform; lastChallenge = initObj.transform.GetComponent <ChallengeInfo>(); } }
// 添加item void AddItem(ChallengeInfo info) { if (info == null) { return; } UnityEngine.GameObject item = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/PartnerPvp/RecordCell")); item = NGUITools.AddChild(grid.gameObject, item); if (item != null) { RecordCell cell = item.GetComponent <RecordCell>(); if (cell != null) { cell.InitItemInfo(info); } } recordDic.Add(item, info); }
private byte[] CreateDigestResponse(ChallengeInfo challenge) { if ((challenge.QOP & QualityOfProtection.AuthenticationOnly) == 0) { throw new SaslException("Currently, DigestMD5Client only supports \"auth\" QOP value."); } // cipher is only used in "auth-conf", which we don't support yet. if (!challenge.Algorithm.EqualsOrdinalCI("md5-sess")) { throw new SaslException($"Invalid DIGEST-MD5 Algorithm: '{challenge.Algorithm}' - must be 'md5-sess'"); } if (!challenge.Realms.Contains(_realm)) { // Do we care? The server would reject us anyway if the Realm is invalid } var result = new DigestResponse { Username = _username, Realm = _realm, QOP = QualityOfProtection.AuthenticationOnly, Charset = "utf-8", NonceCount = 1, MaxBuf = 65536, Nonce = challenge.Nonce, DigestUri = "ldap/" + _host }; var cnonce = new byte[32]; _rng.GetBytes(cnonce); result.CNonce = Utilclass.Base64.Encode(cnonce); var ha1 = DigestCalcHa1(result); result.Response = DigestCalcResponse(result, ha1); var resultStr = result.ToString(); return(resultStr.ToUtf8Bytes()); }
public void OnChallenge(int from, ChallengeInfo info) { User user = this.GetUser(from); if (user != null) { if (this._userInfo.State == UserState.Free) { if (this.OnReceiveChallenge != null) { this.OnReceiveChallenge(this._challengeManager.ReceiveChallenge(user, info)); } } else { this.RefuseChallenge(from); } } }
void SpawnChallenge2() { dist = 25f; Vector3 spawnPoint = new Vector3(469.945f, 15f, zPos); Quaternion spawnRot = new Quaternion(0, 0, 0, 0); dist = 28f; GameObject challenge2Clone = Instantiate(challenge2, spawnPoint, spawnRot); ChallengeInfo challengeInfo = challenge2Clone.GetComponent <ChallengeInfo> (); challengeInfo.player = player; challengeInfo.colorCount = 0; challengeInfo.player1 = GameObject.Find("Player1").GetComponent <PlayerState> (); challengeInfo.luz = GameObject.Find("Directional Light").GetComponent <Light> (); challengeInfo.wall1[0] = GameObject.Find("Wall3").GetComponent <Renderer>(); challengeInfo.wall1[1] = GameObject.Find("Wall4").GetComponent <Renderer>(); challenge2Clone.name = "Desafio"; challengeInfo.nomeObj = "Challenge2"; }
internal void ChallengeResult(ChallengeInfo info, bool IsSuccess) { if (info.IsDone) { return; } ArenaInfo challenger = m_Rank.GetRankEntityById(info.Challenger.Guid); ArenaInfo target = m_Rank.GetRankEntityById(info.Target.Guid); info.Challenger.Rank = challenger.GetRank(); info.Target.Rank = target.GetRank(); if (IsSuccess && IsRankShouldChange(info.Challenger.Rank, info.Target.Rank)) { m_Rank.ExchangeRank(challenger, target); } info.IsDone = true; info.IsChallengerSuccess = IsSuccess; if (IsChallengeOverTime(info)) { info.ChallengeEndTime = info.ChallengeDeadLine; challenger.LastBattleTime = info.ChallengeDeadLine; } else { info.ChallengeEndTime = DateTime.Now; challenger.LastBattleTime = DateTime.Now; } m_DoingChallenges.Remove(challenger.GetId()); AddChallengeHistory(info.Challenger.Guid, info); AddChallengeHistory(info.Target.Guid, info); UserInfo challenge_user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(info.Challenger.Guid); SendResultMsg(info, challenge_user); UserInfo target_user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(info.Target.Guid); SendResultMsg(info, target_user); LogSys.Log(LOG_TYPE.DEBUG, "-----send challenge result msg"); /// RecordChallengeAction(challenger, target, IsSuccess); }
private void CreateChallenge() { ChallengeInfo challengeInfo = _challengeList[Random.Range(0, _challengeList.Count - 1)]; int x = Random.Range(challengeInfo.minXValue, challengeInfo.maxXValue); int score = (int)(x * challengeInfo.multiplier); switch (challengeInfo.name) { case "ForeverAltitudeChallenge": break; case "ForeverAnchorChallenge": break; case "ForeverMoonstoneChallenge": break; case "StageAltitudeChallenge": break; case "StageAnchorChallenge": break; case "StageMoonstoneChallenge": break; case "CharacterChallenge": break; case "RockChallenge": break; } PlayerPrefs.SetString("ChallengeName", challengeInfo.name); PlayerPrefs.SetInt("ChallengeX", x); PlayerPrefs.SetInt("ChallengeCUrrent", 0); PlayerPrefs.SetInt("ChallengeScore", score); }
public override byte[] EvaluateChallenge(byte[] challenge) { byte[] response = null; switch (_currentState) { case State.Initial: var challengeInfo = new ChallengeInfo(challenge); response = CreateDigestResponse(challengeInfo); _currentState = State.DigestResponseSent; break; case State.DigestResponseSent: if (CheckServerResponseAuth(challenge)) { _currentState = State.ValidServerResponse; } else { _currentState = State.InvalidServerResponse; throw new SaslException("Could not validate response-auth " + "value from server"); } break; case State.ValidServerResponse: case State.InvalidServerResponse: throw new SaslException("Authentication sequence is complete"); case State.Disposed: throw new SaslException("Client has already been disposed"); default: throw new SaslException("Unknown client state."); } return(response); }
private void ChallengeAnsweredCallback(RPCContext context) { ChallengeAnsweredResponse challengeAnsweredResponse = ChallengeAnsweredResponse.ParseFrom(context.Payload); if (!challengeAnsweredResponse.IsInitialized) { return; } ulong challengeId = 0UL; if (!this.s_pendingAnswers.TryGetValue(context.Header.Token, out challengeId)) { return; } if (challengeAnsweredResponse.HasDoRetry && challengeAnsweredResponse.DoRetry) { ChallengeInfo item = default(ChallengeInfo); item.challengeId = challengeId; item.isRetry = true; this.m_challengeUpdateList.Add(item); } this.s_pendingAnswers.Remove(context.Header.Token); }
private int GetMaxDamage(ChallengeInfo cInfo) { List <int> damageList = new List <int>(); damageList.Add(cInfo.Challenger.UserDamage); damageList.Add(cInfo.Target.UserDamage); if (cInfo.Challenger.PartnerDamage != null) { foreach (DamageInfo pd in cInfo.Challenger.PartnerDamage) { damageList.Add(pd.Damage); } } if (cInfo.Target.PartnerDamage != null) { foreach (DamageInfo pd in cInfo.Target.PartnerDamage) { damageList.Add(pd.Damage); } } damageList.Sort(); return(damageList[damageList.Count - 1]); }
void Update() { int RandomInt; GameObject initObj; Transform currentChild; for (int i = 0; i < transform.childCount; i++) { currentChild = transform.GetChild(i); if (currentChild.GetComponent <ChallengeInfo>().GetEndPos().x - circle.position.x <= -15.0f) { Destroy(currentChild.gameObject); } if (lastChallenge && lastChallenge.GetEndPos().x - circle.position.x >= 5f) { RandomInt = Random.Range(0, challenges.Length); initObj = Instantiate(challenges[RandomInt], lastChallenge.GetEndPos(), Quaternion.identity) as GameObject; initObj.transform.parent = transform; lastChallenge = initObj.transform.GetComponent <ChallengeInfo>(); return; } } }
private void ChallengeUserCallback(RPCContext context) { ChallengeUserRequest challengeUserRequest = ChallengeUserRequest.ParseFrom(context.Payload); if (!challengeUserRequest.IsInitialized) { return; } ulong num = (ulong)challengeUserRequest.Id; bool flag = false; for (int i = 0; i < challengeUserRequest.ChallengesCount; i++) { Challenge challenge = challengeUserRequest.Challenges[i]; if (challenge.Type == 5265220u) { flag = true; break; } } if (!flag) { this.AbortChallenge(num); return; } ChallengePickedRequest challengePickedRequest = new ChallengePickedRequest(); challengePickedRequest.SetChallenge(5265220u); challengePickedRequest.SetId((uint)num); challengePickedRequest.SetNewChallengeProtocol(true); RPCContext rpccontext = this.m_rpcConnection.QueueRequest(this.ChallengeService.Id, 1u, challengePickedRequest, new RPCContextDelegate(this.ChallengedPickedCallback), 0u); ChallengeInfo value = default(ChallengeInfo); value.challengeId = num; value.isRetry = false; this.m_challengePendingList.Add(rpccontext.Header.Token, value); }
public static void Main(string[] args) { client = new HttpClient(); client.BaseAddress = new Uri("https://fortnite-api.theapinetwork.com/"); client.DefaultRequestHeaders.Add("Authorization", apiKey); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); List <UnreleasedProduct> FortMap = new List <UnreleasedProduct>(); List <BRNews> FortNews = new List <BRNews>(); List <WeaponInfo> FortWeapon = new List <WeaponInfo>(); List <CreativeInfo> FortCreative = new List <CreativeInfo>(); List <ItemShop> FortStore = new List <ItemShop>(); ChallengeList FortChal = new ChallengeList(); try { Console.WriteLine("Enter UI for Upcoming Items"); Console.WriteLine("Enter GN for In Game News"); Console.WriteLine("Enter WL for Weapons List"); Console.WriteLine("Enter CL for Creative List"); Console.WriteLine("Enter IS for Item Shop"); Console.WriteLine("Enter CH for Challenges"); Console.WriteLine(""); Console.Write("Select what you want to see: "); string ans = Console.ReadLine(); switch (ans) { case "UI": FortMap = GetUpcomingItems(); Console.WriteLine($"Number of upcoming items = {FortMap.Count}"); for (int index = 0; index < FortMap.Count; index++) { UnreleasedProduct currentProduct = FortMap[index]; Console.WriteLine(""); Console.WriteLine($"ItemId = {currentProduct.ItemId} "); Console.WriteLine($"Name = { currentProduct.Item.Name } Type = { currentProduct.Item.Type} Rarity = { currentProduct.Item.Rarity} "); Console.WriteLine($"Description = { currentProduct.Item.Description } Cost = { currentProduct.Item.Cost } Upcoming = { currentProduct.Item.Upcoming }"); Console.WriteLine($"Icon = { currentProduct.Item.Images.Icon } Featured = { currentProduct.Item.Images.Featured }"); Console.WriteLine($"Background = { currentProduct.Item.Images.Background } Information = { currentProduct.Item.Images.Information }"); } Console.WriteLine(""); break; case "GN": FortNews = GetInGameNews(); Console.WriteLine($"Number of in game news = {FortNews.Count}"); for (int index = 0; index < FortNews.Count; index++) { BRNews ingameNews = FortNews[index]; Console.WriteLine(""); Console.WriteLine($"Title = { ingameNews.Title } Body = { ingameNews.Body } "); Console.WriteLine($"Image = { ingameNews.Image}"); } Console.WriteLine(""); break; case "WL": FortWeapon = GetWeaponList(); Console.WriteLine($"Number of weapons = {FortWeapon.Count}"); for (int index = 0; index < FortWeapon.Count; index++) { WeaponInfo weaponArsenal = FortWeapon[index]; Console.WriteLine(""); Console.WriteLine($"Identifier = { weaponArsenal.Identifier } Name = { weaponArsenal.Name}"); Console.WriteLine($"Rarity = { weaponArsenal.Rarity } Image = { weaponArsenal.Image }"); Console.WriteLine($"Dps = { weaponArsenal.Stats.Dps } HitBody = { weaponArsenal.Stats.HitBody }"); Console.WriteLine($"HitHead = { weaponArsenal.Stats.HitHead } FireRate = { weaponArsenal.Stats.FireRate }"); Console.WriteLine($"MagazineSize = { weaponArsenal.Stats.MagazineSize } ReloadTime = { weaponArsenal.Stats.ReloadTime }"); Console.WriteLine($"AmmoCost = { weaponArsenal.Stats.AmmoCost }"); } Console.WriteLine(""); break; case "CL": FortCreative = GetCreativeList(); Console.WriteLine($"Number of featured creative islands = {FortCreative.Count}"); for (int index = 0; index < FortCreative.Count; index++) { CreativeInfo currentIslands = FortCreative[index]; Console.WriteLine(""); Console.WriteLine($"Island Code = {currentIslands.Island.Code} Island Name = {currentIslands.Island.Name}"); Console.WriteLine($"Island Description = {currentIslands.Island.Description}"); Console.WriteLine($"Creator Username = {currentIslands.Island.Creator.Username}"); } Console.WriteLine(""); break; case "IS": FortStore = GetItemShop(); Console.WriteLine($"Number of items in the shop = {FortStore.Count}"); for (int index = 0; index < FortStore.Count; index++) { ItemShop currentItems = FortStore[index]; Console.WriteLine(""); Console.WriteLine($"ItemId = {currentItems.ItemId} "); Console.WriteLine($"Featured = {currentItems.Store.IsFeatured} Refundable = {currentItems.Store.IsRefundable}"); Console.WriteLine($"Cost = {currentItems.Store.Cost} New = {currentItems.Store.IsNew}"); Console.WriteLine($"Name = {currentItems.Item.Name} Type = {currentItems.Item.Type}"); Console.WriteLine($"Rarity = {currentItems.Item.Rarity}"); Console.WriteLine($"Icon = {currentItems.Item.Images.Icon} Background = {currentItems.Item.Images.Background}"); Console.WriteLine($"Information = {currentItems.Item.Images.Information}"); } Console.WriteLine(""); break; case "CH": FortChal = GetSeasonChallenges(); int challengeCount = 0; FortChal.Challenges.ForEach(week => { challengeCount += week.Entries.Count; }); Console.WriteLine($"Number of challenges = {challengeCount}"); Console.WriteLine($"Language = {FortChal.Language} Season = {FortChal.Season} Star = {FortChal.Star}"); for (int index = 0; index < FortChal.Challenges.Count; index++) { ChallengeInfo seasonChallenge = FortChal.Challenges[index]; Console.WriteLine(""); Console.WriteLine($"Week = {seasonChallenge.Week} Value = {seasonChallenge.Value}"); seasonChallenge.Entries.ForEach(challenge => { Console.WriteLine($"Identifier = {challenge.Identifier} Challenge = {challenge.Challenge}"); Console.WriteLine($"Total = {challenge.Total} Stars = {challenge.Stars}"); Console.WriteLine($"Difficulty = {challenge.Difficulty}"); }); } Console.WriteLine(""); break; } } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadLine(); }
/// <summary> /// nhận indicator thách đấu từ server trả về /// </summary> /// <param name="msg"></param> public async void OnReciveChallengeInd(QHMessage msg) { long SenderID = 0; // QHNumber long TargetType = 0; // QHNumber{ 0 : Player, 1:Club } long TargetID = 0; // QHNumber ID of TargetType string Content = ""; // QHString (Nội dung text hoặc json của Challenges) long StartTime = 0; // QHNumber Thời gian thách đấu bắt đầu long EndTime = 0; // QHNumber Thời gian thách đấu kết thúc long ChallengeID = 0; // QHNumber ID của lời mời thách đấu if (msg.TryGetAt((byte)MsgInviteChallengeIndArg.SenderID, ref SenderID)) { } if (msg.TryGetAt((byte)MsgInviteChallengeIndArg.TargetType, ref TargetType)) { } if (msg.TryGetAt((byte)MsgInviteChallengeIndArg.TargetID, ref TargetID)) { } if (msg.TryGetAt((byte)MsgInviteChallengeIndArg.Content, ref Content)) { } if (msg.TryGetAt((byte)MsgInviteChallengeIndArg.StartTime, ref StartTime)) { } if (msg.TryGetAt((byte)MsgInviteChallengeIndArg.EndTime, ref EndTime)) { } if (msg.TryGetAt((byte)MsgInviteChallengeIndArg.ChallengeID, ref ChallengeID)) { } var Chall = new ChallengeInfo(); Chall.SenderID = SenderID; Chall.TargetType = TargetType; Chall.TargetID = TargetID; Chall.Content = Content; Chall.StartTime = StartTime; Chall.EndTime = EndTime; Chall.ChallengeID = ChallengeID; Accountlocal AccLocal = new Accountlocal(); if (Helper.Instance().ListAcclocal.ContainsKey(SenderID)) { AccLocal = Helpers.Helper.Instance().ListAcclocal[SenderID]; } else { var accounOwner = await Helper.Instance().CheckExistAccount(SenderID); if (accounOwner != null) { var acccount = new Accountlocal(); acccount.Challenge = "pingpong.png"; acccount.Blade = "Cốt A - Hãng A"; acccount.Facebat = "Mặt A - Hãng A"; acccount.Level = "Hạng A"; acccount.AccepLevel = "Đã Duyệt"; acccount.AddFriend = Helper.Instance().IsFriendImg(accounOwner.Number_Id); acccount.TextStatusFriend = Helper.Instance().IsFriend(accounOwner.Number_Id); acccount.TextAcceptFriend = Helper.Instance().TextAcceptFriend; acccount.Number_Id = accounOwner.Number_Id; acccount.fullname = accounOwner.fullname; acccount.Avatar_Uri = accounOwner.Avatar_Uri; Helper.Instance().ListAcclocal.Add(SenderID, acccount); AccLocal = acccount; } } // Thách đấu cá nhân if (TargetType == 0) { Device.BeginInvokeOnMainThread(() => { DependencyService.Get <ILocalNotificationService>().LocalNotification("AppBongBan", AccLocal.fullname + " đã gửi lời mời thách đấu đến bạn", (int)Helpers.Notifi.Challenge, 0); }); Chall.Acc = AccLocal; if (!ChallengeAction.ListSendAcc.ContainsKey(SenderID)) { ChallengeAction.ListSendAcc.Add(SenderID, Chall); } Device.BeginInvokeOnMainThread(() => { ListChallengesPer.Add(Chall); count += ListChallengesPer.Count; notify = count.ToString(); // Helper.Instance().challengeNotify?.Invoke(); }); } // Thách đấu Club else { var club = await Helper.Instance().CheckExistClub(TargetID); Chall.Clubs = club; Chall.Acc = AccLocal; Device.BeginInvokeOnMainThread(() => { DependencyService.Get <ILocalNotificationService>().LocalNotification("AppBongBan", AccLocal.fullname + " đã gửi lời mời thách đấu đến " + club.ClubName, (int)Helpers.Notifi.Challenge, 0); }); if (!ChallengeAction.ListSendClub.ContainsKey(SenderID)) { ChallengeAction.ListSendClub.Add(SenderID, Chall); } Device.BeginInvokeOnMainThread(() => { ListChallengesClub.Add(Chall); count += ListChallengesClub.Count; notify = count.ToString(); }); } // Thông báo để thêm vào chuông cho người dùng biết Helper.Instance().CountChallengeNotifi++; //Helper.Instance().challengeNotify?.Invoke(); AppChat.Helpers.Helper.Instiance().NotifiAction?.Invoke(); }
/// <summary> /// Nhận danh sách các thách đấu từ server trả về liên quan đến người dùng và quản lý Club /// </summary> /// <param name="msg"></param> public async void OnReciveListChallenge(QHMessage msg) { long Error = 0; // QHNumber QHTable ClubChallenges = new QHTable(); // QHTable{ChallengeID(0):QHNumber, SenderID(1):QHNumber, TargetID(2):QHNumber, Content(3):QHString, CreateTime(4):QHNumber,StartTime(5):QHNumber,EndTime(6):QHNumber} QHTable PlayerChallenges = new QHTable(); // QHTable{ChallengeID(0):QHNumber, SenderID(1):QHNumber, TargetID(2):QHNumber, Content(3):QHString, CreateTime(4):QHNumber,StartTime(5):QHNumber,EndTime(6):QHNumber} if (msg.TryGetAt((byte)MsgListChallengeAckArg.Error, ref Error)) { } if (msg.TryGetAt((byte)MsgListChallengeAckArg.ClubChallenges, ref ClubChallenges)) { } if (msg.TryGetAt((byte)MsgListChallengeAckArg.PlayerChallenges, ref PlayerChallenges)) { } var acc = Helper.Instance().MyAccount; //Debug.WriteLine("row: "+ ClubChallenges.GetRowCount()); //Debug.WriteLine("row: " + PlayerChallenges.GetRowCount()); if (Error == 0) { var rowCount = ClubChallenges.GetRowCount(); var columCount = ClubChallenges.GetColumnCount(); //danh sách các thách đấu mà admin nhận được hoặc từ các for (int i = 0; i < rowCount; i++) { long ChallengeID = 0; long SenderID = 0; long TargetID = 0; string Content = ""; long CreateTime = 0; long StartTime = 0; long EndTime = 0; if (ClubChallenges.TryGetAt(i, 0, ref ChallengeID)) { } if (ClubChallenges.TryGetAt(i, 1, ref SenderID)) { } if (ClubChallenges.TryGetAt(i, 2, ref TargetID)) { } if (ClubChallenges.TryGetAt(i, 3, ref Content)) { } if (ClubChallenges.TryGetAt(i, 4, ref CreateTime)) { } if (ClubChallenges.TryGetAt(i, 5, ref StartTime)) { } if (ClubChallenges.TryGetAt(i, 6, ref EndTime)) { } var Chall = new ChallengeInfo(); Chall.ChallengeID = ChallengeID; Chall.SenderID = SenderID; Chall.TargetID = TargetID; Chall.Content = Content; Chall.CreateTime = CreateTime; Chall.StartTime = StartTime; Chall.EndTime = EndTime; if (!Helper.Instance().ListClub.TryGetValue(TargetID, out Club clubContent)) { clubContent = new Club() { ClubID = TargetID }; Helper.Instance().ListClub.Add(TargetID, clubContent); } var club = Helper.Instance().ListClub[TargetID]; // Lấy thông tin club Helper.Instance().CheckExistClubAsync(TargetID); Chall.Clubs = club; if (acc.Number_Id == SenderID) { if (!ChallengeAction.ListClubRecive.ContainsKey(TargetID)) { ChallengeAction.ListClubRecive.Add(TargetID, Chall); } } else { if (!ChallengeAction.ListSendClub.ContainsKey(SenderID)) { ChallengeAction.ListSendClub.Add(SenderID, Chall); if (Helpers.Helper.Instance().ListAcclocal.ContainsKey(SenderID)) { var AccLocal = Helpers.Helper.Instance().ListAcclocal[SenderID]; Chall.Acc = AccLocal; Device.BeginInvokeOnMainThread(() => { ListChallengesClub.Add(Chall); // Cập nhật lại số lượng thông báo cho chuông Helper.Instance().CountChallengeNotifi++; count += ListChallengesClub.Count; notify = count.ToString(); // Thông báo để thêm vào chuông cho người dùng biết // Helper.Instance().challengeNotify?.Invoke(); AppChat.Helpers.Helper.Instiance().NotifiAction?.Invoke(); }); } else { var accounOwner = await Helpers.Helper.Instance().CheckExistAccount(SenderID); if (accounOwner != null) { var acccount = new Accountlocal(); acccount.Challenge = "pingpong.png"; acccount.Blade = "Cốt A - Hãng A"; acccount.Facebat = "Mặt A - Hãng A"; acccount.Level = "Hạng A"; acccount.AccepLevel = "Đã Duyệt"; acccount.AddFriend = Helper.Instance().IsFriendImg(accounOwner.Number_Id); acccount.TextStatusFriend = Helper.Instance().IsFriend(accounOwner.Number_Id); acccount.TextAcceptFriend = Helper.Instance().TextAcceptFriend; acccount.Number_Id = accounOwner.Number_Id; acccount.fullname = accounOwner.fullname; acccount.Avatar_Uri = accounOwner.Avatar_Uri; Chall.Acc = acccount; Helpers.Helper.Instance().ListAcclocal.Add(acccount.Number_Id, acccount); Device.BeginInvokeOnMainThread(() => { ListChallengesClub.Add(Chall); // Cập nhật lại số lượng thông báo cho chuông Helper.Instance().CountChallengeNotifi++; count += ListChallengesClub.Count; notify = count.ToString(); // Thông báo để thêm vào chuông cho người dùng biết // Helper.Instance().challengeNotify?.Invoke(); AppChat.Helpers.Helper.Instiance().NotifiAction?.Invoke(); }); } } } } } //danh sách các thách đấu mà người dùng gửi lên hoặc người dùng nhận được for (int i = 0; i < PlayerChallenges.GetRowCount(); i++) { //Debug.WriteLine("Colum: " + PlayerChallenges.GetColumnCount()); long ChallengeID = 0; long SenderID = 0; long TargetID = 0; string Content = ""; long CreateTime = 0; long StartTime = 0; long EndTime = 0; if (PlayerChallenges.TryGetAt(i, 0, ref ChallengeID)) { } if (PlayerChallenges.TryGetAt(i, 1, ref SenderID)) { } if (PlayerChallenges.TryGetAt(i, 2, ref TargetID)) { } if (PlayerChallenges.TryGetAt(i, 3, ref Content)) { } if (PlayerChallenges.TryGetAt(i, 4, ref CreateTime)) { } if (PlayerChallenges.TryGetAt(i, 5, ref StartTime)) { } if (PlayerChallenges.TryGetAt(i, 6, ref EndTime)) { } var Chall = new ChallengeInfo(); Chall.ChallengeID = ChallengeID; Chall.SenderID = SenderID; Chall.TargetID = TargetID; Chall.Content = Content; Chall.CreateTime = CreateTime; Chall.StartTime = StartTime; Chall.EndTime = EndTime; //var club = await Helpers.Helper.Instance().CheckExistClub(TargetID); //Chall.Clubs = club; if (acc == null) { return; } if (acc.Number_Id == SenderID) { Debug.WriteLine("Tra ve true"); Debug.WriteLine("Number_Id: " + acc.Number_Id); Debug.WriteLine("SenderID: " + SenderID); if (!ChallengeAction.ListAccRecive.ContainsKey(TargetID)) { ChallengeAction.ListAccRecive.Add(TargetID, Chall); } } else { Debug.WriteLine("Tra ve false"); if (!ChallengeAction.ListSendAcc.ContainsKey(SenderID)) { ChallengeAction.ListSendAcc.Add(SenderID, Chall); if (Helper.Instance().ListAcclocal.ContainsKey(SenderID)) { var AccLocal = Helper.Instance().ListAcclocal[SenderID]; Chall.Acc = AccLocal; Device.BeginInvokeOnMainThread(() => { ListChallengesPer.Add(Chall); // Cập nhật lại số lượng thông báo cho chuông Helper.Instance().CountChallengeNotifi++; count += ListChallengesPer.Count; notify = count.ToString(); // Thông báo để thêm vào chuông cho người dùng biết // Helper.Instance().challengeNotify?.Invoke(); AppChat.Helpers.Helper.Instiance().NotifiAction?.Invoke(); }); } else { var accounOwner = await Helper.Instance().CheckExistAccount(SenderID); if (accounOwner != null) { var acccount = new Accountlocal(); acccount.Challenge = "pingpong.png"; acccount.Blade = "Cốt A - Hãng A"; acccount.Facebat = "Mặt A - Hãng A"; acccount.Level = "Hạng A"; acccount.AccepLevel = "Đã Duyệt"; acccount.AddFriend = Helper.Instance().IsFriendImg(accounOwner.Number_Id); acccount.TextStatusFriend = Helper.Instance().IsFriend(accounOwner.Number_Id); acccount.TextAcceptFriend = Helper.Instance().TextAcceptFriend; acccount.Number_Id = accounOwner.Number_Id; acccount.fullname = accounOwner.fullname; Debug.WriteLine("Name: " + accounOwner.fullname); Debug.WriteLine("Avatar: " + accounOwner.Avatar_Uri); acccount.Avatar_Uri = accounOwner.Avatar_Uri; Chall.Acc = acccount; Helper.Instance().ListAcclocal.Add(acccount.Number_Id, acccount); Device.BeginInvokeOnMainThread(() => { ListChallengesPer.Add(Chall); count += ListChallengesPer.Count; notify = count.ToString(); // Cập nhật lại số lượng thông báo cho chuông Helper.Instance().CountChallengeNotifi++; // Thông báo để thêm vào chuông cho người dùng biết //Helper.Instance().challengeNotify?.Invoke(); AppChat.Helpers.Helper.Instiance().NotifiAction?.Invoke(); }); } } } } } } }
// Use this for initialization void Start() { ChallengeData = this.GetComponent <ChallengeInfo>(); SliderUI = SliderUI.transform.GetChild(0).gameObject; UpdateAll(); }
public void LoadMenu() { PlayerCharacterScript player = GameObject.FindObjectOfType <PlayerCharacterScript>(); Dictionary <string, object> customProperties; //************************************************************** //Send EventManager StageEnded event EventManager.Instance.SendOnStageEndedEvent((int)player.HighestAltitude, GameManagerScript.Instance.CharacterName); //************************************************************** // ChallengeInfo challengeInfo = null; foreach (ChallengeInfo info in _challengeList) { if (info.name == _challenge.Name) { challengeInfo = info; break; } } if (challengeInfo != null) { int level = ComputeLevel(TotalScore + SessionScore); int score = (int)(_challenge.X * (level + 1) * challengeInfo.multiplier * _challengeScoreMultiplierByLevel[level]); int x = _challenge.X; int current = _challenge.Current; if (score > _challenge.Score) { switch (_challenge.Name) { case "ForeverAltitudeChallenge": _challenge = new ForeverAltitudeChallenge(x, score, current); break; case "ForeverAnchorChallenge": _challenge = new ForeverAnchorChallenge(x, score, current); break; case "ForeverMoonstoneChallenge": _challenge = new ForeverMoonstoneChallenge(x, score, current); break; case "ForeverRockChallenge": _challenge = new ForeverRockChallenge(x, score, current); break; case "StageAltitudeChallenge": _challenge = new StageAltitudeChallenge(x, score, current); break; case "StageAnchorChallenge": _challenge = new StageAnchorChallenge(x, score, current); break; case "StageMoonstoneChallenge": _challenge = new StageMoonstoneChallenge(x, score, current); break; case "CharacterChallenge": break; case "StageRockChallenge": _challenge = new StageRockChallenge(x, score, current); break; } } } //************************************************************** //Update Score SessionScore = (int)UIManager.Instance.Score; if (_challenge.Completed) { SessionScore += _challenge.Score; string challengeName = _challenge.Name; int challengeLifetime = _challenge.Lifetime; int challengeTargetValue = _challenge.X; customProperties = new Dictionary <string, object>() { { "challenge name", challengeName }, { "challenge lifetime", challengeLifetime }, { "challenge targetValue", challengeTargetValue } }; AmplitudeHelper.Instance.LogEvent("Challenge completed", customProperties); } if (SessionScore > BestSessionScore) { BestSessionScore = SessionScore; } int oldLevel = ComputeLevel(TotalScore) + 1; OldTotalScore = TotalScore; TotalScore += SessionScore; int newLevel = ComputeLevel(TotalScore) + 1; //************************************************************** //Clamp Score int totalPossibleScore = 0; foreach (int aaa in _levelExperience) { totalPossibleScore += aaa; } if (TotalScore > totalPossibleScore) { TotalScore = totalPossibleScore; } //************************************************************** //Update PlayerPrefs PlayerPrefs.SetInt("TotalScore", TotalScore); PlayerPrefs.SetInt("BestSessionScore", BestSessionScore); PlayerPrefs.SetInt("ChallengeCurrent", _challenge.Current); PlayerPrefs.SetInt("ChallengeScore", _challenge.Score); //************************************************************** // Send Amplitude LevelUp event if (newLevel > oldLevel && newLevel % 5 == 0) { AmplitudeHelper.Instance.LogEvent("lvl " + newLevel + " reached"); } //************************************************************** //Send Amplitude StageEnd event customProperties = new Dictionary <string, object>() { { "Environment", EnvironmentName }, { "Stage Score", SessionScore }, { "Altitude", player.HighestAltitude }, { "Character", CharacterName }, { "Last Chunk", player.CurrentChunkName } }; AmplitudeHelper.Instance.LogEvent("Stage End", customProperties); //************************************************************** //Load Menu scene SceneManager.LoadSceneAsync("Scenes/Menu"); }
//初始化item信息 public void InitItemInfo(ChallengeInfo info) { int maxRank = 8000; ArenaBaseConfig bc = ArenaConfigProvider.Instance.GetBaseConfigById(1); if (null != bc) { maxRank = bc.MaxRank + 1; } RoleInfo role = LobbyClient.Instance.CurrentRole; ChallengeEntityInfo challengeInfo; if (role.Guid == info.Challenger.Guid) { // 自己是挑战者 challengeInfo = info.Target; int rankUp = 0; if (info.IsChallengerSuccess) { // 挑战别人赢了 if (info.Target.Rank < 0) { // 别人未上榜 , 名次不变 rankUp = 0; } else if (info.Challenger.Rank == -1 && info.Target.Rank > 0) { //自己未上榜 别人在榜上 rankUp = maxRank - info.Target.Rank; } else { // 都在榜上 if (info.Challenger.Rank - info.Target.Rank < 0) { // 名次高于他人 ,此时名次不变 rankUp = 0; } else {//自己在榜上 ,且名次低于他人, 改变名次此时要改变名次 rankUp = info.Challenger.Rank - info.Target.Rank; } } winLabel.text = rankUp.ToString(); NGUITools.SetActive(win, true); NGUITools.SetActive(fail, false); } else {// 挑战他人失败 if (winLabel != null) { failNum.text = "0"; } NGUITools.SetActive(win, false); NGUITools.SetActive(fail, true); } } else { // 自己是被挑战者 challengeInfo = info.Challenger; if (info.IsChallengerSuccess) { // 挑战者赢了 (我输了), NGUITools.SetActive(win, false); NGUITools.SetActive(fail, true); if (winLabel != null) { int rankUp = 0; if (info.Target.Rank == -1) {// 我未上榜 rankUp = 0; } else if (info.Challenger.Rank == -1) { // 他未上榜,那么我将是未上榜的人了 下降自己的名次 rankUp = info.Target.Rank + 1; } else if (info.Target.Rank - info.Challenger.Rank > 0) { // 都在榜上,我名次低于他 名次不变 rankUp = 0; } else { // 我名次高于他 rankUp = info.Challenger.Rank - info.Target.Rank; } failNum.text = rankUp.ToString(); } } else { // 我赢了(挑战的人输了) 名次不变 NGUITools.SetActive(win, true); NGUITools.SetActive(fail, false); if (winLabel != null) { winLabel.text = "0"; } } } if (playerName != null) { playerName.text = challengeInfo.NickName; } if (playerLevel != null) { playerLevel.text = "Lv." + challengeInfo.Level.ToString(); } if (PlayerScore != null) { PlayerScore.text = challengeInfo.FightScore.ToString(); } if (heroHead != null) { Data_PlayerConfig cg = PlayerConfigProvider.Instance.GetPlayerConfigById(challengeInfo.HeroId); heroHead.spriteName = cg.m_PortraitForCell; } }
public void Challenge(int target, ChallengeInfo info) { base.Send(RoomClientHelper.Challenge(target, info)); }
public void Insert(ChallengeInfo cha) { StringBuilder strSQL = new StringBuilder(); //SqlParameter[] orderParms = GetOrderParameters(); }
protected override void Init() { Settings = LocalRecordsSettings.ReadFromFile(PluginSettingsFilePath); try { AdapterProvider = AdapterProviderFactory.GetAdapterProvider(Settings); ChallengeAdapter = AdapterProvider.GetChallengeAdapter(); PlayerAdapter = AdapterProvider.GetPlayerAdapter(); PositionAdapter = AdapterProvider.GetPositionAdapter(); RecordAdapter = AdapterProvider.GetRecordAdapter(); RatingAdapter = AdapterProvider.GetRatingAdapter(); SessionAdapter = AdapterProvider.GetSessionAdapter(); RankingAdapter = AdapterProvider.GetRankingAdapter(); } catch (Exception ex) { Logger.Error("Error initializing AdapterProvider for local records.", ex); Logger.ErrorToUI(string.Format("An error occured. {0} not started!", Name)); return; } List <ChallengeListSingleInfo> challenges = GetChallengeList(); if (challenges == null) { return; } try { Logger.InfoToUI("Starting to delete data of missing tracks"); int amountOfDeletedTracks = ChallengeAdapter.DeleteTracksNotInProvidedList(challenges.ConvertAll(c => c.UId)); Logger.InfoToUI(string.Format("Data of {0} Track(s) has been deleted.", amountOfDeletedTracks)); } catch (Exception ex) { Logger.ErrorToUI("Couldn't delete data of missing tracks.", ex); } foreach (PlayerSettings playerSettings in Context.PlayerSettings.GetAllAsList()) { if (!playerSettings.NickName.IsNullOrTimmedEmpty()) { PlayerAdapter.CreateOrUpdate(new Player(playerSettings.Login, playerSettings.NickName)); } } ChallengeInfo currentChallengeInfo = GetCurrentChallengeInfoCached(); if (currentChallengeInfo == null) { Logger.ErrorToUI(string.Format("An error occured. {0} not started!", Name)); return; } EnsureChallengeExistsInStorage(currentChallengeInfo); DetermineLocalRecords(); InitializePlugins(); OnLocalRecordsDetermined(new List <RankEntry>(LocalRecords)); Context.RPCClient.Callbacks.BeginRace += Callbacks_BeginRace; Context.RPCClient.Callbacks.EndRace += Callbacks_EndRace; Context.RPCClient.Callbacks.PlayerConnect += Callbacks_PlayerConnect; Context.RPCClient.Callbacks.PlayerDisconnect += Callbacks_PlayerDisconnect; Context.RPCClient.Callbacks.PlayerFinish += Callbacks_PlayerFinish; Context.RPCClient.Callbacks.PlayerChat += Callbacks_PlayerChat; }
private void InitVictoryPanel(ChallengeInfo cInfo) { RoleInfo role = LobbyClient.Instance.CurrentRole; if (role == null) { return; } UIManager.Instance.ShowWindowByName("PPVPVictoryPanel"); ChallengeEntityInfo myCInfo = cInfo.Target.Guid == role.Guid ? cInfo.Target : cInfo.Challenger; ChallengeEntityInfo theirCInfo = cInfo.Target.Guid == role.Guid ? cInfo.Challenger : cInfo.Target; bool isWin = cInfo.Target.Guid == role.Guid ? cInfo.IsChallengerSuccess ? false : true : cInfo.IsChallengerSuccess ? true : false; if (spHeadL != null) { spHeadL.spriteName = GetHeadSpName(myCInfo.HeroId); } if (spHeadR != null) { spHeadR.spriteName = GetHeadSpName(theirCInfo.HeroId); } if (lblNameL != null) { lblNameL.text = myCInfo.NickName; } if (lblNameR != null) { lblNameR.text = theirCInfo.NickName; } if (isWin) { if (win != null) { NGUITools.SetActive(win.gameObject, true); NGUITools.SetActive(lose.gameObject, false); } } else { if (lose != null) { NGUITools.SetActive(win.gameObject, false); NGUITools.SetActive(lose.gameObject, true); } } m_MaxDamage = GetMaxDamage(cInfo); for (int i = 0; i < leftItemList.Count; i++) { if (i == 0) {//主角 UpdateItem(leftItemList[i], myCInfo.HeroId, myCInfo.UserDamage, true); } else { if (myCInfo.PartnerDamage != null && myCInfo.PartnerDamage.Count >= i) { UpdateItem(leftItemList[i], myCInfo.PartnerDamage[i - 1].OwnerId, myCInfo.PartnerDamage[i - 1].Damage, false); NGUITools.SetActive(leftItemList[i], true); } else { NGUITools.SetActive(leftItemList[i], false); } } } for (int i = 0; i < rightItemList.Count; i++) { if (i == 0) {//主角 UpdateItem(rightItemList[i], theirCInfo.HeroId, theirCInfo.UserDamage, true); } else { if (theirCInfo.PartnerDamage != null && theirCInfo.PartnerDamage.Count >= i) { UpdateItem(rightItemList[i], theirCInfo.PartnerDamage[i - 1].OwnerId, theirCInfo.PartnerDamage[i - 1].Damage, false); NGUITools.SetActive(rightItemList[i], true); } else { NGUITools.SetActive(rightItemList[i], false); } } } }
public void ShowRecord(ChallengeInfo cInfo) { RoleInfo role = LobbyClient.Instance.CurrentRole; if (role == null) { return; } UIManager.Instance.ShowWindowByName("PPVPRecordData"); ChallengeEntityInfo myCInfo = cInfo.Target.Guid == role.Guid ? cInfo.Target : cInfo.Challenger; ChallengeEntityInfo theirCInfo = cInfo.Target.Guid == role.Guid ? cInfo.Challenger : cInfo.Target; bool isWin = cInfo.Target.Guid == role.Guid ? cInfo.IsChallengerSuccess ? false : true : cInfo.IsChallengerSuccess ? true : false; if (spHeadL != null) { spHeadL.spriteName = GetHeadSpName(myCInfo.HeroId); } if (spHeadR != null) { spHeadR.spriteName = GetHeadSpName(theirCInfo.HeroId); } if (lblNameL != null) { lblNameL.text = myCInfo.NickName; } if (lblNameR != null) { lblNameR.text = theirCInfo.NickName; } if (spWinOrLose != null) { spWinOrLose.spriteName = isWin ? "win" : "lose"; int num = spWinOrLose.transform.childCount; for (int i = 0; i < num; i++) { NGUITools.SetActive(spWinOrLose.transform.GetChild(i).gameObject, isWin); } } m_MaxDamage = GetMaxDamage(cInfo); for (int i = 0; i < leftItemList.Count; i++) { if (i == 0) {//主角 UpdateItem(leftItemList[i], myCInfo.HeroId, myCInfo.UserDamage, true); } else { if (myCInfo.PartnerDamage != null && myCInfo.PartnerDamage.Count >= i) { UpdateItem(leftItemList[i], myCInfo.PartnerDamage[i - 1].OwnerId, myCInfo.PartnerDamage[i - 1].Damage, false); NGUITools.SetActive(leftItemList[i], true); } else { NGUITools.SetActive(leftItemList[i], false); } } } for (int i = 0; i < rightItemList.Count; i++) { if (i == 0) {//主角 UpdateItem(rightItemList[i], theirCInfo.HeroId, theirCInfo.UserDamage, true); } else { if (theirCInfo.PartnerDamage != null && theirCInfo.PartnerDamage.Count >= i) { UpdateItem(rightItemList[i], theirCInfo.PartnerDamage[i - 1].OwnerId, theirCInfo.PartnerDamage[i - 1].Damage, false); NGUITools.SetActive(rightItemList[i], true); } else { NGUITools.SetActive(rightItemList[i], false); } } } }
static void Postfix(MissionHelpSO missionHelp, MissionHelpViewController __instance) { if (missionHelp is CustomMissionHelpSO) { ChallengeInfo challengeInfo = (missionHelp as CustomMissionHelpSO).challengeInfo; string imagePath = (missionHelp as CustomMissionHelpSO).imagePath; Transform content = __instance.transform.GetChild(0); TextMeshProUGUI title = content.GetChild(0).GetComponent <TextMeshProUGUI>(); Transform seperatorPrefab = content.GetChild(1).GetChild(1); Transform segmentPrefab = content.GetChild(1).GetChild(2); GameObject.Destroy(title.GetComponent <LocalizedTextMeshProUGUI>()); title.text = challengeInfo.title; Transform infoContainer = GameObject.Instantiate(content.GetChild(1), content); infoContainer.gameObject.SetActive(true); if (lastInfo != null) { GameObject.Destroy(lastInfo.gameObject); } lastInfo = infoContainer; foreach (Transform child in infoContainer) { GameObject.Destroy(child.gameObject); } foreach (ChallengeInfo.InfoSegment infoSegment in challengeInfo.segments) { Transform segment = GameObject.Instantiate(segmentPrefab, infoContainer); GameObject.Destroy(segment.GetComponentInChildren <LocalizedTextMeshProUGUI>()); if (infoSegment.text == "") { GameObject.Destroy(segment.GetComponentInChildren <TextMeshProUGUI>().gameObject); } else { segment.GetComponentInChildren <TextMeshProUGUI>().text = infoSegment.text; } Image image = segment.GetComponentInChildren <Image>(); if (infoSegment.imageName == "") { GameObject.Destroy(image.gameObject); } else { image.sprite = null; if (imageLoader == null) { imageLoader = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); } imageLoader.StartCoroutine(LoadSprite("file:///" + imagePath + infoSegment.imageName, image)); } if (infoSegment.hasSeperator) { GameObject.Instantiate(seperatorPrefab, infoContainer); } } } else { __instance.transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = "NEW OBJECTIVE"; } }
internal static ArkCrossEngineMessage.ChallengeInfoData CreateChallengeInfoData(ChallengeInfo info) { ArkCrossEngineMessage.ChallengeInfoData msg = new ArkCrossEngineMessage.ChallengeInfoData(); msg.Challenger = CreateChallengeEntityData(info.Challenger); msg.Target = CreateChallengeEntityData(info.Target); msg.IsChallengeSuccess = info.IsChallengerSuccess; msg.EndTime = info.ChallengeEndTime.Ticks; return(msg); }
public void Init(ChallengeInfo info) { this.info = info; Refresh(); }