public async Task ListFilterWordExcludes(CommandContext ctx) { if (ctx.Member.GetRole().IsModOrHigher()) { StringBuilder sb = new StringBuilder(); // Cancels: if (Excludes.GetWordCount() == 0) { await ctx.Channel.SendMessageAsync( ChatObjects.GetNeutralMessage(@"There are no filter excludes...")); return; } foreach (string word in Excludes.GetWords()) { sb.AppendLine(word); } DiscordEmbedBuilder deb = new DiscordEmbedBuilder() { Color = DiscordColor.LightGray, Description = sb.ToString(), Title = "FILTER LIST EXCLUDES" }; await ctx.Channel.SendMessageAsync(embed : deb.Build()); } }
public async Task GetUserInfo(CommandContext ctx, DiscordMember member) { if (ctx.Member.GetRole().IsCHOrHigher()) { await ctx.Channel.TriggerTypingAsync(); if (ctx.Guild.Members.ContainsKey(member.Id)) { // DEB! var deb = new DiscordEmbedBuilder(); deb.WithColor(DiscordColor.Aquamarine); deb.WithTitle("User Info"); deb.WithThumbnailUrl(member.AvatarUrl); deb.AddField(@"Joined Discord:", GetDateString(GetJoinedDiscordTime(member.Id))); deb.AddField($"Joined {ctx.Guild.Name}:", GetDateString(member.JoinedAt)); await ctx.Channel.SendMessageAsync(embed : deb); } else { await ctx.Channel.SendMessageAsync(ChatObjects.GetErrMessage("User not found!")); } } }
public async Task FilterExclude(CommandContext ctx, string word) { if (ctx.Member.GetRole().IsSeniorModOrHigher()) { await ctx.TriggerTypingAsync(); // Cancels: if (FilterSystem.IsWord(word)) { await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Cannot add that word. It's a filter word...")); return; } if (Excludes.IsExcluded(word)) { await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Cannot add that word. It's already excluded...")); return; } Excludes.AddWord(word); Excludes.Save(); await ctx.Channel.SendMessageAsync( ChatObjects.GetSuccessMessage( String.Format("I excluded the word {0}!", word))); } }
public async Task ExcludeChannel(CommandContext ctx, [Description("Exclude a channel")] DiscordChannel chan) { // Check if the user can use config commands. if (ctx.Member.GetRole().IsBotManagerOrHigher()) { await ctx.Channel.TriggerTypingAsync(); // Cancels: if (BotSettings.IsChannelExcluded(chan)) { // This channel does not exist. await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Unable to uexclude channel. This channel is already excluded...")); return; } if (!ctx.Guild.Channels.ContainsKey(chan.Id)) { // This channel is not in the guild. await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Unable to exclude channel. This channel does not exist in this server...")); return; } BotSettings.ExcludeChannel(chan); BotSettings.Save(); await ctx.Channel.SendMessageAsync( ChatObjects.GetSuccessMessage( String.Format("{0} was successfully excluded!", chan.Mention))); } }
public async Task SetFilterChannel(CommandContext ctx, [Description("The channel to set the filter logs to.")] DiscordChannel chan) { // Check if the user can use these sorts of commands. if (ctx.Member.GetRole().IsBotManagerOrHigher()) { await ctx.TriggerTypingAsync(); // Cancels: if (BotSettings.FilterChannelId == chan.Id) { // Trying to set the channel to itself. await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Unable to set filter channel. That's already the channel...")); return; } if (!ctx.Guild.Channels.ContainsKey(chan.Id)) { // Channel does not exist. await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Unable to set filter channel. Does not exist or is not in this guild...")); return; } // Update the settings. BotSettings.FilterChannelId = chan.Id; BotSettings.Save(); // Success message. await ctx.Channel.SendMessageAsync( ChatObjects.GetSuccessMessage( String.Format("Filter channel set to {0}!", chan.Mention))); } }
public async Task RemoveFilterWords(CommandContext ctx, params string[] words) { // Check if the user can use commands. if (ctx.Member.GetRole().IsSeniorModOrHigher()) { await ctx.TriggerTypingAsync(); StringBuilder sb_fail = new StringBuilder(); // A list of words we haven't been able to add. StringBuilder sb_success = new StringBuilder(); // A list of words we were able to add. DiscordEmbedBuilder deb; foreach (string word in words) { // Check if this is already in the filter list. If it is not, we were unsuccessful at adding it to the list. bool success = FilterSystem.IsWord(word); if (success) { FilterSystem.RemoveWord(word); sb_success.Append(word + @", "); } else { sb_fail.Append(word + @", "); } } // DEB! deb = new DiscordEmbedBuilder() { Description = ChatObjects.GetNeutralMessage(@"I attempted to remove those words you gave me."), Color = DiscordColor.LightGray }; deb.WithThumbnailUrl(ChatObjects.URL_FILTER_SUB); // For each of these lists, we want to remove the last two characters, because every string will have an ", " at the end of it. if (sb_success.Length > 0) { deb.AddField("Successfully removed:", sb_success.Remove(sb_success.Length - 2, 2).ToString()); } if (sb_fail.Length > 0) { deb.AddField("Not removed:", sb_fail.Remove(sb_fail.Length - 2, 2).ToString()); } FilterSystem.Save(); await ctx.Channel.SendMessageAsync(embed : deb.Build()); } }
public async Task RemoveReminder(CommandContext ctx, string reminderId) { if (ctx.Member.GetRole().IsCHOrHigher()) { await ctx.TriggerTypingAsync(); // Cancels: if (!ReminderSystem.IsReminder(reminderId)) { await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"That is not a valid Reminder ID...")); return; } Reminder reminderToRemove = ReminderSystem.GetReminderFromId(reminderId); // DEB! DiscordEmbedBuilder deb = new DiscordEmbedBuilder(); DateTimeOffset dto = DateTimeOffset.FromUnixTimeMilliseconds(reminderToRemove.Time); // The reminder's DTO. TimeSpan remainingTime = dto.Subtract(DateTimeOffset.UtcNow); // The remaining time left for the reminder. string originalAuthorMention = String.Format("<@{0}>", reminderToRemove.User); deb.WithTitle(@"Notification Removed"); deb.AddField(@"User", originalAuthorMention); deb.AddField(@"Time", dto.ToString()); deb.AddField(@"Remaining time", String.Format("{0}day {1}hr {2}min {3}sec", remainingTime.Days, remainingTime.Hours, remainingTime.Minutes, remainingTime.Seconds)); deb.AddField(@"Message", reminderToRemove.Text); deb.AddField(@"Notification Identifier", reminderId); deb.WithColor(DiscordColor.LightGray); deb.WithThumbnailUrl(ChatObjects.URL_REMINDER_DELETED); ReminderSystem.RemoveReminder(reminderToRemove); ReminderSystem.Save(); await ctx.Channel.SendMessageAsync(originalAuthorMention, false, deb); } }
public async Task FilterInclude(CommandContext ctx, string word) { if (ctx.Member.GetRole().IsSeniorModOrHigher()) { await ctx.TriggerTypingAsync(); if (!Excludes.IsExcluded(word)) { await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Cannot un-exclude that word. It's not already excluded...")); } else { Excludes.RemoveWord(word); Excludes.Save(); await ctx.Channel.SendMessageAsync( ChatObjects.GetSuccessMessage(@"I removed that word from exclusion!")); } } }
public async Task ListExcludes(CommandContext ctx) { if (ctx.Member.GetRole().IsCHOrHigher()) { await ctx.Channel.TriggerTypingAsync(); // Cancels: if (BotSettings.GetExcludedChannelsCount == 0) { await ctx.Channel.SendMessageAsync( ChatObjects.GetNeutralMessage(@"There are no excluded channels...")); return; } // DEB! DiscordEmbedBuilder deb = new DiscordEmbedBuilder { Title = "Excluded Channels" }; StringBuilder sb = new StringBuilder(); // Write out every channel being excluded into a cute little list. foreach (DiscordChannel chan in await BotSettings.GetExcludedChannels()) { sb.AppendLine(chan.Mention); } deb.Description = sb.ToString(); deb.WithColor(DiscordColor.LightGray); deb.WithThumbnailUrl(ChatObjects.URL_SPEECH_BUBBLE); await ctx.Channel.SendMessageAsync(embed : deb); } }
public async Task AddReminder(CommandContext ctx, params string[] paramsList) { if (ctx.Member.GetRole().IsCHOrHigher()) { string args = ctx.RawArgumentString; int firstQuote = args.IndexOf('['); int secondQuote = args.LastIndexOf(']'); // Let's try to get the date, first of all. string dateSubstring; // If there's no quote, let's just see what happens if we put the whole string in. if (firstQuote == -1) { dateSubstring = args.TrimStart(); } else { dateSubstring = args.TrimStart(' ').Substring(0, firstQuote); } MatchCollection matches = DateRegex.Matches(dateSubstring); DateTimeOffset dto = ctx.Message.CreationTimestamp.UtcDateTime; foreach (Match match in matches) { if (match.Groups.Count == 3) { // Check if it's an integer just in case... if (Int32.TryParse(match.Groups[1].Value, out int measure)) { InterpretTime( measure: measure, unit: match.Groups[2].Value, dto: ref dto); } } } // Cancels: ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! if (dto.UtcTicks == ctx.Message.CreationTimestamp.UtcTicks) { // No time has been added. await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"Invalid time string...")); return; } DateTimeOffset yearFromNow = new DateTimeOffset(ctx.Message.CreationTimestamp.UtcDateTime).AddYears(1); if (dto.UtcTicks > yearFromNow.UtcTicks) { // More than a year away. await ctx.Channel.SendMessageAsync( ChatObjects.GetErrMessage(@"That's more than one year away. Please reduce your time...")); return; } // Great, so now we have our time string. Now we need to try and figure out what our message string is. string msgString = @"no message provided"; // Just checking to make sure everything is in bounds. if (firstQuote != -1 && firstQuote + 1 < args.Length && secondQuote - 1 > firstQuote) { if (secondQuote == -1) { msgString = args.Substring(firstQuote + 1); } else { msgString = args.Substring(firstQuote + 1, secondQuote - firstQuote - 1); } } // Now we have our message string. Let's see if there are any mentions. IEnumerable <ulong> mentionIds = from mentionId in ctx.Message.MentionedUsers.Select(a => a.Id).Distinct() where mentionId != 669347771312111619 && // Do not allow mentions of the bot, mentionId != 676710243878830090 && // the dev bot, mentionId != ctx.Message.Author.Id // or the user who called the function. select mentionId; StringBuilder sb = new StringBuilder(); // DEB! DiscordEmbedBuilder deb = new DiscordEmbedBuilder(); Reminder reminder = new Reminder { Text = msgString, Time = dto.ToUnixTimeMilliseconds(), User = ctx.Member.Id, Channel = ctx.Channel.Id, UsersToNotify = mentionIds.ToArray() }; foreach (ulong mentionId in mentionIds) { sb.Append(String.Format("<@{0}> ", mentionId)); } deb.WithTitle(@"Notification"); deb.AddField(@"User", ctx.Member.Mention); deb.AddField(@"Time", dto.ToString()); deb.AddField(@"Message", msgString); if (sb.Length > 0) { deb.AddField(@"Users to notify:", sb.ToString().TrimEnd()); } deb.AddField(@"Notification Identifier", reminder.GetIdentifier()); deb.WithThumbnailUrl(ChatObjects.URL_REMINDER_GENERIC); ReminderSystem.AddReminder(reminder); ReminderSystem.Save(); await ctx.Channel.SendMessageAsync(String.Empty, false, deb); } }
// Use this for initialization void Start() { ChatButton = GameObject.Find("ChatButton").GetComponent<Button>(); co = ChatButton.GetComponent<ChatObjects>(); ChatPanel = co.ChatPanel; ChatContent = co.ChatContent; ExitButton = co.ExitButton; SendButton = co.SendButton; chatInput = co.chatInput; scrollbar = co.scrollbar; //ChatPanel = GameObject.Find("ChatPanel"); //ChatContent = GameObject.Find("ChatContent"); //ExitButton = GameObject.Find("ExitButton").GetComponent<Button>(); //SendButton = GameObject.Find("SendButton").GetComponent<Button>(); //chatInput = GameObject.Find("ChatInputField").GetComponent<InputField>(); //scrollbar = GameObject.Find("Scrollbar Vertical").GetComponent<Scrollbar>(); chatInput.onEndEdit.RemoveAllListeners(); chatInput.onEndEdit.AddListener(onEndEditChatInput); ChatButton.onClick.RemoveAllListeners(); ChatButton.onClick.AddListener(() => { onChatButtonClick(); }); ExitButton.onClick.RemoveAllListeners(); ExitButton.onClick.AddListener(() => { onExitButtonClick(); }); SendButton.onClick.RemoveAllListeners(); SendButton.onClick.AddListener(() => { onSendButtonClick(); }); ChatPanel.SetActive(false); playerBox = GameObject.Find("Player Box"); normalRoom = GameObject.Find("Normal Door"); bossRoom = GameObject.Find("Boss Door"); p1 = GameObject.Find("PlayerInfoContainer1"); p2 = GameObject.Find("PlayerInfoContainer2"); p3 = GameObject.Find("PlayerInfoContainer3"); p4 = GameObject.Find("PlayerInfoContainer4"); enemy = GameObject.Find("EnemyInfoContainer"); container = GameObject.Find("Container"); if (isLocalPlayer) { if (numOfPlayer < 4) { p4.SetActive(false); if (numOfPlayer < 3) { p3.SetActive(false); if (numOfPlayer < 2) { p2.SetActive(false); } } } if (string.IsNullOrEmpty(pName)) { co.localPlayerName = ""; } else { co.localPlayerName = pName; } playerNameText = GameObject.Find("Name").GetComponent<Text>(); if (playerNameText != null) { playerNameText.text = "You are " + pName; } } id = int.Parse(GetComponent<NetworkIdentity>().netId.ToString()); PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); PlayerPortraitText.text = pName; OnPlayerName(pName); //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); //if (numOfPlayer == 1) //{ // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); //} //if (numOfPlayer == 2) //{ // if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 3) // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // } // else // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // } //} //if (numOfPlayer == 3) //{ // if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 4) // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // } // else // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // } //} //if (numOfPlayer == 4) //{ // if (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) == 5) // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer)).GetComponent<Text>(); // } // else // { // PlayerPortraitText = GameObject.Find("PlayerName" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // PlayerPortraitText.text = pName; // OnPlayerName(pName); // //playerHealthText = GameObject.Find("PlayerHealth" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerEnergyText = GameObject.Find("PlayerEnergy" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // //playerHealthImage = GameObject.Find("PlayerHealthBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //playerEnergyImage = GameObject.Find("PlayerEnergyBar" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Image>(); // //turnText = GameObject.Find("Turn" + int.Parse(GetComponent<NetworkIdentity>().netId.ToString())).GetComponent<Text>(); // characterImage = GameObject.Find("PlayerPortrait" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerHealthText = GameObject.Find("PlayerHealth" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerEnergyText = GameObject.Find("PlayerEnergy" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // playerHealthImage = GameObject.Find("PlayerHealthBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // playerEnergyImage = GameObject.Find("PlayerEnergyBar" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Image>(); // turnText = GameObject.Find("Turn" + (int.Parse(GetComponent<NetworkIdentity>().netId.ToString()) - numOfPlayer - 1)).GetComponent<Text>(); // } //} turn = pName + ":Your Turn"; OnTurnChanged(turn); playerHealth = PLAYER_HEALTH; playerEnergy = PLAYER_ENERGY; playerCountText = GameObject.Find("PlayerCount").GetComponent<Text>(); countText = GameObject.Find("Count").GetComponent<Text>(); playerCount = numOfPlayer; count = playerCount; OnCountChanged(count); OnPlayerCountChanged(playerCount); canvasText = GameObject.Find("Canvas").GetComponent<Text>(); canvas = false; OnCanvasChanged(canvas); enemyHealthText = GameObject.Find("EnemyHealth").GetComponent<Text>(); enemyHealth = ENEMY_HEALTH; enemyHealth2Text = GameObject.Find("EnemyHealth2").GetComponent<Text>(); enemyHealth2 = ENEMY_HEALTH; enemyEnergyText = GameObject.Find("EnemyEnergy").GetComponent<Text>(); enemyEnergy = ENEMY_ENERGY; enemyHealthImage = GameObject.Find("EnemyHealthBar").GetComponent<Image>(); enemyEnergyImage = GameObject.Find("EnemyEnergyBar").GetComponent<Image>(); currentState = BattleStates.PLAYERCHOICE; characterImage.sprite = Resources.Load<Sprite>(characterName) as Sprite; if(isServer) RpcChangeBoxImage(); container.GetComponent<CanvasGroup>().alpha = 0; }