Ejemplo n.º 1
0
    private void OnClickEmoticon(IUIObject obj)
    {
        if (this.m_eChatType == CHAT_TYPE.BABELPARTY || this.m_eChatType == CHAT_TYPE.MYTHRAID)
        {
            BabelTower_ChatDlg babelTower_ChatDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BABELTOWER_CHAT) as BabelTower_ChatDlg;

            if (babelTower_ChatDlg != null)
            {
                babelTower_ChatDlg.AddChatText((string)obj.Data);
            }
        }
        else if (this.m_eChatType == CHAT_TYPE.NUM)
        {
            New_Whisper_Dlg new_Whisper_Dlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.WHISPER_DLG) as New_Whisper_Dlg;

            if (new_Whisper_Dlg != null)
            {
                new_Whisper_Dlg.AddChatText((string)obj.Data);
            }
        }
        else if (this.m_eChatType == CHAT_TYPE.STORYCHAT)
        {
            StoryChatDetailDlg storyChatDetailDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.STORYCHATDETAIL_DLG) as StoryChatDetailDlg;

            if (storyChatDetailDlg != null)
            {
                storyChatDetailDlg.AddComment((string)obj.Data);
            }
        }
        else
        {
            ChatManager.AddChatText((string)obj.Data);
        }
    }
Ejemplo n.º 2
0
        public override void Click(UIMouseEvent evt)
        {
            if (Main.keyState.IsKeyDown(Main.FavoriteKey))
            {
                if (Main.drawingPlayerChat)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (var item in Main.recipe[index].requiredItem)
                    {
                        if (!item.IsAir)
                        {
                            sb.Append(ItemTagHandler.GenerateTag(item));
                        }
                    }
                    sb.Append("-->");
                    sb.Append(ItemTagHandler.GenerateTag(Main.recipe[index].createItem));
                    if (ChatManager.AddChatText(Main.fontMouseText, sb.ToString(), Vector2.One))
                    {
                        Main.PlaySound(SoundID.MenuTick);
                    }
                }
                else
                {
                    RecipeBrowserUI.instance.FavoriteChange(this.index, !favorited);
                }
            }
            else
            {
                RecipeCatalogueUI.instance.SetRecipe(index);
                RecipeCatalogueUI.instance.queryLootItem = Main.recipe[index].createItem;
                RecipeCatalogueUI.instance.updateNeeded  = true;
            }

            for (int n = 0; n < Main.numAvailableRecipes; n++)
            {
                if (index == Main.availableRecipe[n])
                {
                    Main.playerInventory = true;
                    Main.focusRecipe     = n;
                    Main.recFastScroll   = true;
                    break;
                }
            }

            // Idea: Glint the CraftUI tab if extended craft available?
        }
Ejemplo n.º 3
0
        private void Autocomplete()
        {
            if (!Config.Instance.EnableChatAutofill)
            {
                return;
            }

            if (Main.drawingPlayerChat &&
                (OpenedChatWithMouseItem || MouseItemChangedToPetItem))
            {
                if (!Main.chatText.StartsWith(PRCommand.CommandStart) && Main.chatText.Length == 0)
                {
                    ChatManager.AddChatText(Main.fontMouseText, PRCommand.CommandStart, Vector2.One);
                }
            }

            prevItemType = Main.mouseItem?.type ?? 0;
        }
Ejemplo n.º 4
0
 public override void OnClick()
 {
     ChatManager.AddChatText(Main.fontMouseText, "[e:" + sn + "]", Vector2.One);
 }
Ejemplo n.º 5
0
        private bool ItemSlot_OverrideLeftClick(On.Terraria.UI.ItemSlot.orig_OverrideLeftClick orig, Item[] inv, int context, int slot)
        {
            Item item = inv[slot];

            //Check if the slot has no item in it and the favorite key is down and if the item in the slot can actually be favorited
            if (item.IsAir && Main.keyState.IsKeyDown(Main.FavoriteKey) && CanFavoriteAt[context])
            {
                //If true, add lock to inventory slot
                item.SetDefaults(ModContent.ItemType <ItemLock>());
                //Favorite lock item
                item.favorited = true;
                //Play sound
                Main.PlaySound(SoundID.Unlock);
                return(true);
            }

            if (Main.cursorOverride == 2)
            {
                if (ChatManager.AddChatText(Main.fontMouseText, ItemTagHandler.GenerateTag(item), Vector2.One))
                {
                    Main.PlaySound(12, -1, -1, 1, 1f, 0f);
                }

                return(true);
            }

            if (Main.cursorOverride == 3)
            {
                if (!CanFavoriteAt[context])
                {
                    return(false);
                }

                item.favorited = !item.favorited;
                Main.PlaySound(12, -1, -1, 1, 1f, 0f);
                return(true);
            }
            else
            {
                if (Main.cursorOverride == 7)
                {
                    inv[slot] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, inv[slot], false, true);
                    Main.PlaySound(12, -1, -1, 1, 1f, 0f);
                    return(true);
                }

                if (Main.cursorOverride == 8)
                {
                    inv[slot] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, inv[slot], false, true);

                    if (Main.player[Main.myPlayer].chest > -1)
                    {
                        NetMessage.SendData(32, -1, -1, null, Main.player[Main.myPlayer].chest, slot, 0f, 0f, 0, 0, 0);
                    }

                    return(true);
                }

                if (Main.cursorOverride == 9)
                {
                    ChestUI.TryPlacingInChest(inv[slot], false);
                    return(true);
                }

                return(false);
            }
        }