Exemplo n.º 1
0
    public void CreateEntry(string name, string text, string entryType, GameObject WhoEntered)
    {
        print("Create Entry");
        ChatEntry temp = Instantiate(ChatEntryPrefab, ScrollContentStartingPoint);

        if (entryType == "All")
        {
            EntryCount++;
            temp.CreateMessege(name + ": " + text, AllChatColor, entryType, EntryCount, gameObject);
            GlobalChatEntries.Enqueue(temp);
            EveryEntry.Enqueue(temp);
            if (EntryList != 0)
            {
                temp.gameObject.SetActive(false);
            }
            BroadcastEntry(temp, WhoEntered.GetComponent <Chat>());
        }
        else if (entryType == "Team1")
        {
            if (NP.GetTeamNum() == 1)
            {
                EntryCount++;
                temp.CreateMessege(name + ": " + text, TeamChatColor, entryType, EntryCount, gameObject);
                TeamChatEntries.Enqueue(temp);
                EveryEntry.Enqueue(temp);
                if (EntryList != 1)
                {
                    temp.gameObject.SetActive(false);
                }
                BroadcastEntry(temp, WhoEntered.GetComponent <Chat>());
            }
        }
        else if (entryType == "Team2")
        {
            if (NP.GetTeamNum() == 2)
            {
                EntryCount++;
                temp.CreateMessege(name + ": " + text, TeamChatColor, entryType, EntryCount, gameObject);
                TeamChatEntries.Enqueue(temp);
                EveryEntry.Enqueue(temp);
                if (EntryList != 2)
                {
                    temp.gameObject.SetActive(false);
                }
                BroadcastEntry(temp, WhoEntered.GetComponent <Chat>());
            }
        }
        else if (entryType == "Console")
        {
            EntryCount++;
            temp.CreateMessege(name + ": " + text, ConsoleColor, entryType, EntryCount, gameObject);
            ConsoleEntries.Enqueue(temp);
            if (EntryList != 3)
            {
                temp.gameObject.SetActive(false);
            }
        }
    }
Exemplo n.º 2
0
 public void CreateConsoleEntry(string name, string text)
 {
     if (IgnoreCopies)
     {
         bool CompleteCommand = true;
         foreach (ChatEntry c in ConsoleEntries)
         {
             if (c.EntryText == name + ": " + text)
             {
                 CompleteCommand = false;
                 break;
             }
         }
         if (CompleteCommand)
         {
             ChatEntry temp = Instantiate(ChatEntryPrefab, ScrollContentStartingPoint);
             EntryCount++;
             temp.CreateMessege(name + ": " + text, ConsoleColor, "Console", EntryCount, gameObject);
             ConsoleEntries.Enqueue(temp);
             if (EntryList != 3)
             {
                 temp.gameObject.SetActive(false);
             }
         }
     }
 }