Exemplo n.º 1
0
        public float AddHeight(Dalamud.Game.ClientState.Actors.Types.Chara chara)
        {
            float Height = chara.Customize[(int)Dalamud.Game.ClientState.Actors.CustomizeIndex.Height];
            int   race   = chara.Customize[(int)Dalamud.Game.ClientState.Actors.CustomizeIndex.Race];
            int   gender = chara.Customize[(int)Dalamud.Game.ClientState.Actors.CustomizeIndex.Gender];

            switch ((Race)race)
            {
            case Race.Hyur:     return(1.50f + 0.002f * Height);

            case Race.Elezen:   return(1.80f + 0.002f * Height);

            case Race.Lalafell: return(1.00f + 0.001f * Height);

            case Race.Miqote:   return(1.45f + 0.003f * Height);

            case Race.Roegadyn: return(2.00f + 0.001f * Height);

            case Race.AuRa:
                if (gender == (int)Gender.Male)
                {
                    return(2.00f + 0.001f * Height);
                }
                else
                {
                    return(1.40f + 0.001f * Height);
                }

            case Race.Hrothgar: return(1.85f + 0.002f * Height);

            case Race.Viera:    return(1.75f + 0.002f * Height);
            }
            return(minH + maxH * Height);
        }
Exemplo n.º 2
0
        public void DrawChatBubble(Dalamud.Game.ClientState.Actors.Types.Chara actor, ChatText chat)
        {
            if (pluginInterface.Framework.Gui.WorldToScreen(new SharpDX.Vector3(actor.Position.X, actor.Position.Z + AddHeight(actor), actor.Position.Y), out SharpDX.Vector2 pos))
            {
                int lookup = GetChatPos(actor.Name);

                String[] senderSplit = chat.Sender.Split(' ');
                string   senderName  = senderSplit[0] + " " + senderSplit[1];

                ImGui.PushStyleVar(ImGuiStyleVar.WindowMinSize, new Num.Vector2(ImGui.CalcTextSize(senderName).X + 50, 20));
                ImGui.Begin(chat.Sender + bubbleOffsets[lookup].extra.ToString(), ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground);
                ImGui.SetWindowPos(new Num.Vector2(pos.X + 30 + bubbleOffsets[lookup].x, pos.Y + bubbleOffsets[lookup].y));

                ImGui.PushStyleColor(ImGuiCol.Text, UintCol(0, 0, 0, 0));
                if (bubblesChannel)
                {
                    ImGui.Text(chat.ChannelShort + ": "); ImGui.SameLine();
                }
                string message = TextTypesToString(chat.Text);


                ImGui.PushTextWrapPos(maxBubbleWidth);
                ImGui.TextWrapped(message);
                ImGui.PopTextWrapPos();
                ImGui.PopStyleColor();
                ImGui.PopStyleVar();



                bubbleOffsets[lookup].Pos    = ImGui.GetWindowPos();
                bubbleOffsets[lookup].Width  = ImGui.GetWindowWidth();
                bubbleOffsets[lookup].Height = ImGui.GetWindowHeight();

                resolveCollision(lookup, pos, true);
                Num.Vector2 finalpos = ImGui.GetWindowPos();

                ImGui.End();



                //WIP
                float ImageWidth  = 12.5f * ((bubbleOffsets[lookup].Width - 25f) / 12.5f) - xCut;
                float ImageHeight = 12.5f * ((bubbleOffsets[lookup].Height - 25f) / 12.5f) - yCut;
                //uint colour = ImGui.GetColorU32(new Num.Vector4(255, 255, 255, 255));


                ImGui.PushStyleVar(ImGuiStyleVar.WindowMinSize, new Num.Vector2(ImGui.CalcTextSize(senderName).X + 50, 20));
                ImGui.Begin(chat.Sender + "visible" + bubbleOffsets[lookup].extra.ToString(), ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground);
                ImGui.SetWindowPos(new Num.Vector2(pos.X + 30 + bubbleOffsets[lookup].x, pos.Y + bubbleOffsets[lookup].y));

                //Draw Box
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp, finalpos.Y + yDisp));
                //ImGui.GetWindowDrawList().AddRectFilled(new Num.Vector2(finalpos.X + xDisp, finalpos.Y + yDisp), new Num.Vector2(finalpos.X + xDisp + 25f + ImageWidth, finalpos.Y + 25f + ImageHeight + yDisp), UintCol(high.htA, high.htB, high.htG, high.htR), bubbleRounding);
                ImGui.GetWindowDrawList().AddRectFilled(new Num.Vector2(finalpos.X + xDisp, finalpos.Y + yDisp), new Num.Vector2(finalpos.X + xDisp + 25f + ImageWidth, finalpos.Y + 25f + ImageHeight + yDisp), ImGui.GetColorU32(bubbleColour[chat.ChannelColour]), bubbleRounding);
                //Draw Outside
                //Top Left of Box (Set size)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp, finalpos.Y + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(12.5f, 12.5f), bubble_TL1, bubble_TL2);
                //Top Middle of Box (Variable Width)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp + 12.5f, finalpos.Y + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(ImageWidth, 12.5f), bubble_TM1, bubble_TM2);
                //Top Right of Box (Set Size)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp + 12.5f + ImageWidth, finalpos.Y + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(12.5f, 12.5f), bubble_TR1, bubble_TR2);
                //Mid Left of Box (Variable Hight)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp, finalpos.Y + 12.5f + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(12.5f, ImageHeight), bubble_ML1, bubble_ML2);
                //Mid Middle of Box (Variable Width and Height)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp + 12.5f, finalpos.Y + 12.5f + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(ImageWidth, ImageHeight), bubble_MM1, bubble_MM2);
                //Mid Right of Box (Variable Height)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp + 12.5f + ImageWidth, finalpos.Y + 12.5f + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(12.5f, ImageHeight), bubble_MR1, bubble_MR2);
                //Bot Left of Box (Set Size)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp, finalpos.Y + 12.5f + ImageHeight + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(12.5f, 12.5f), bubble_BL1, bubble_BL2);
                //Bot Middle of Box (Variable Width)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp + 12.5f, finalpos.Y + 12.5f + ImageHeight + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(ImageWidth, 12.5f), bubble_BM1, bubble_BM2);
                //Bot Right of Box (Set Size)
                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + xDisp + 12.5f + ImageWidth, finalpos.Y + 12.5f + ImageHeight + yDisp));
                ImGui.Image(goatImage.ImGuiHandle, new Num.Vector2(12.5f, 12.5f), bubble_BR1, bubble_BR2);


                ImGui.SetCursorScreenPos(new Num.Vector2(finalpos.X + 12, finalpos.Y + 6 + ((ImGui.GetFontSize() - 15) / 3)));

                ImGui.PushStyleColor(ImGuiCol.Text, UintCol(255, 0, 0, 0));
                if (bubblesChannel)
                {
                    ImGui.Text(chat.ChannelShort + ": "); ImGui.SameLine();
                }


                ImGui.PushTextWrapPos(maxBubbleWidth);
                ImGui.TextWrapped(message); ImGui.SameLine(); ImGui.Text(" ");
                ImGui.PopTextWrapPos();
                ImGui.PopStyleColor();


                ImGui.PopStyleVar();
                ImGui.End();

                ImGui.Begin(chat.Sender + "Name" + bubbleOffsets[lookup].extra.ToString(), ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground);

                ImGui.SetWindowPos(new Num.Vector2(finalpos.X + 5, finalpos.Y - 18));

                ImGui.PushStyleColor(ImGuiCol.Text, UintCol(255, 0, 0, 0));
                Num.Vector2 finalpos2 = ImGui.GetCursorPos();
                ImGui.SetCursorPos(new Num.Vector2(finalpos2.X + 1, finalpos2.Y + 1 - ((ImGui.GetFontSize() - 15) / 3)));
                ImGui.Text(chat.Sender);
                ImGui.PopStyleColor();
                ImGui.SetCursorPos(new Num.Vector2(finalpos2.X, finalpos2.Y - ((ImGui.GetFontSize() - 15) / 3)));
                ImGui.Text(chat.Sender);
                ImGui.End();

                /* Working on indicator
                 * ImGui.Begin(chat.Sender + "Arrow" + bubbleOffsets[lookup].extra.ToString(), ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.AlwaysAutoResize);
                 * ImGui.GetWindowDrawList().AddTriangle(
                 *  new Num.Vector2(10, 10),
                 *  new Num.Vector2(10, 50),
                 *  new Num.Vector2(50, 50),
                 *  ImGui.GetColorU32(bubbleColour[chat.ChannelColour]),
                 *  2.0f
                 *  );
                 * ImGui.End();
                 */
            }
        }