private void SwitchLeader(ulong ID, CTypes type) { if (configData.Options.UseBetterChat && BetterChat) { var name = GetGroupName(type); if (UserInGroup(titleCache[type].UserID.ToString(), name)) { RemoveFromGroup(titleCache[type].UserID.ToString(), name); } AddToGroup(ID.ToString(), name); } titleCache[type] = new LeaderData { Count = statCache[ID].Stats[type], DisplayName = statCache[ID].DisplayName, UserID = ID }; if (configData.Options.AnnounceNewLeaders) { string message = MSG("newLeader", ID.ToString()) .Replace("{playername}", $"{configData.Messaging.MSG_ColorMain}{statCache[ID].DisplayName}</color>{configData.Messaging.MSG_ColorMsg}") .Replace("{ctype}", $"</color>{configData.Messaging.MSG_ColorMain}{MSG(type.ToString().ToLower(), ID.ToString())}</color>"); PrintToChat(message); } }
private void SwitchLeader(ulong newId, ulong oldId, Challenges type) { var name = GetGroupName(type); if (configData.Options.UseOxideGroups) { if (oldId != 0U && permission.GroupExists(name)) { RemoveUserFromGroup(name, oldId.ToString()); } if (newId != 0U && permission.GroupExists(name)) { AddUserToGroup(name, newId.ToString()); } } titleCache[type] = new LeaderData { Count = statCache[newId].Stats[type], DisplayName = statCache[newId].DisplayName, UserID = newId }; if (configData.Options.AnnounceNewLeaders) { string message = MSG("newLeader") .Replace("{playername}", $"<color={configData.Colors.TextColor1}>{statCache[newId].DisplayName}</color><color={configData.Colors.TextColor2}>") .Replace("{ctype}", $"</color><color={configData.Colors.TextColor1}>{MSG(type.ToString())}</color>"); PrintToChat(message); } }
/// <summary> /// Saves this session to a file. /// </summary> /// <param name="fname">The output file.</param> public void Save(string fname) { /** * Save format: * - Session name * - Speed * - Leader trajectory * - Participant trajectory * - Commands */ // Create the directories if necessary. string dname = System.IO.Path.GetDirectoryName(fname); System.IO.Directory.CreateDirectory(dname); // Write out the sample. BinaryWriter bstream; // Open up the binary stream. bstream = new BinaryWriter( new FileStream( fname, FileMode.Create)); Debug.Assert(bstream != null); // Write name bstream.Write(Name); // Write speed bstream.Write(Speed); // Write leader data LeaderData.Save(bstream); // Write player data PlayerData.Save(bstream); // Write gid's now... // Write header. bstream.Write((int)Commands.Count); // Write each gid for (int ii = 0; ii < Commands.Count; ii++) { bstream.Write(Commands[ii].First); bstream.Write(Commands[ii].Second); } // Clean up. bstream.Close(); }
public void TargetChanged() { string leaderName = LeaderDetailManger.Instance.Target; if (PlayerPrefs.HasKey(leaderName)) { string json = PlayerPrefs.GetString(leaderName); Debug.Log("LeaderDetail Target Changed ::::" + json); data = JsonUtility.FromJson<LeaderData>(json); } else { Debug.Log("LeaderUpgradeButton ::: No has key!!"); } LevelBarInit(); }
public override void Create(System.Collections.Generic.Dictionary <string, object> dataDict) { Debug.Log("IgniteLeaderBoard:Create"); base.Create(dataDict); if (dataDict.ContainsKey("currentUserId")) { this.CurrentUserId = Convert.ToString(dataDict["currentUserId"]); } if (dataDict.ContainsKey("rule")) { System.Collections.Generic.Dictionary <string, object> leaderBoardRuleDict = dataDict["rule"] as System.Collections.Generic.Dictionary <string, object>; this.Rule = LeaderBoardRuleData.ParseFromDictionary(leaderBoardRuleDict); } this.Leaders = new System.Collections.Generic.List <LeaderData>(); if (dataDict.ContainsKey("leaderList")) { System.Collections.Generic.Dictionary <string, object> leaderListDict = dataDict["leaderList"] as System.Collections.Generic.Dictionary <string, object>; if (leaderListDict.ContainsKey("leaders")) { System.Collections.Generic.List <object> leaderList = leaderListDict["leaders"] as System.Collections.Generic.List <object>; int position = 1; foreach (object leaderObject in leaderList) { System.Collections.Generic.Dictionary <string, object> leaderDict = leaderObject as System.Collections.Generic.Dictionary <string, object>; LeaderData leaderData = LeaderData.ParseFromDictionary(leaderDict); if (this.CurrentUserId == leaderData.Id) { leaderData.IsCurrentUser = true; } leaderData.Rank = position; this.Leaders.Add(leaderData); position++; } } } if (dataDict.ContainsKey("metadata")) { System.Collections.Generic.Dictionary <string, object> metadataDict = dataDict["metadata"] as System.Collections.Generic.Dictionary <string, object>; this.Metadata = LeaderBoardMetadata.ParseFromDictionary(metadataDict); } }
public static LeaderData ParseFromDictionary(System.Collections.Generic.Dictionary <string, object> leaderDict) { LeaderData leaderData = new LeaderData(); if (leaderDict.ContainsKey("id")) { leaderData.Id = Convert.ToString(leaderDict["id"]); } if (leaderDict.ContainsKey("name")) { leaderData.Name = Convert.ToString(leaderDict["name"]); } if (leaderDict.ContainsKey("score")) { leaderData.Score = Convert.ToInt32(leaderDict["score"]); } if (leaderDict.ContainsKey("rank")) { leaderData.Rank = Convert.ToInt32(leaderDict["rank"]); } return(leaderData); }
private void OnActiveLeaderSkill(LeaderData data) { totalLeaderCD -= data.BaseCd; UpdateCD(totalLeaderCD); }
private void OnActiveLeaderSkill(LeaderData data) { //battleModeHandler.SetBattleField(TeamController, MonsterController, charactersLeft, "ActiveSkill"); RequestRecords(); }