コード例 #1
0
        public string FindCode(string code)
        {
            if (Free.Contains(code))
            {
                return("GoA");
            }
            if (SimulatedTwilightTown.Contains(code))
            {
                return("Simulated Twilight Town");
            }
            if (TwilightTown.Contains(code))
            {
                return("Twilight Town");
            }
            if (HollowBastion.Contains(code))
            {
                return("Hollow Bastion");
            }
            if (LandOfDragons.Contains(code))
            {
                return("Land of Dragons");
            }
            if (BeastsCastle.Contains(code))
            {
                return("Beasts Castle");
            }
            if (OlympusColiseum.Contains(code))
            {
                return("Olympus Coliseum");
            }
            if (DisneyCastle.Contains(code))
            {
                return("Disney Castle");
            }
            if (PortRoyal.Contains(code))
            {
                return("Port Royal");
            }
            if (Agrabah.Contains(code))
            {
                return("Agrabah");
            }
            if (HalloweenTown.Contains(code))
            {
                return("Halloween Town");
            }
            if (PrideLands.Contains(code))
            {
                return("Pride Lands");
            }
            if (Atlantica.Contains(code))
            {
                return("Atlantica");
            }
            if (AcreWood.Contains(code))
            {
                return("Hundred Acre Wood");
            }
            if (SpaceParanoids.Contains(code))
            {
                return("Space Paranoids");
            }
            if (TheWorldThatNeverWas.Contains(code))
            {
                return("TWTNW");
            }
            if (Forms.Contains(code))
            {
                return("Drive Forms");
            }
            if (Levels.Contains(code))
            {
                return("Soras Heart");
            }

            return("");
        }
コード例 #2
0
        public ContextMenuForm()
        {
            W = 120;
            if (BG == null)
            {
                BG = new Texture.Texture2D("data/nxUI/bg/winBody4.png", Texture.LoadMethod.Single, true);
            }

            MouseMove = (x, y, dx, dy) =>
            {
                int h = 2;

                foreach (var sub_item in Items)
                {
                    //DrawText(sub_item.Text, 2, h, new OpenTK.Vector4(0.2f, 0.2f, 0.2f, 0.9f));
                    if (x > 0 && x < W && y > h && y < (h + 25))
                    {
                        if (OverItem != null && OverItem != sub_item)
                        {
                            if (Forms.Contains(OverItem.Menu))
                            {
                                Forms.Remove(OverItem.Menu);
                            }
                        }
                        OverItem = sub_item;
                    }
                    h = h + 25;
                }
                if (OverItem != null)
                {
                    if (OverItem.Menu.Items.Count > 0)
                    {
                        OverItem.Menu.X = W;
                        OverItem.Menu.Y = 10;
                        OverItem.Menu.W = 120;
                        OverItem.Menu.H = OverItem.Menu.Items.Count * 25;
                        if (!Forms.Contains(OverItem.Menu))
                        {
                            Add(OverItem.Menu);
                        }
                    }
                }
            };
            MouseLeave = () =>
            {
                //  UI.CurUI.ActiveMenu = null;
            };

            Click = (b) =>
            {
                if (b == 0)
                {
                    if (OverItem != null)
                    {
                        OverItem.Click?.Invoke();
                        UI.CurUI.ActiveMenu = null;
                    }
                    ;
                }
            };

            Draw = () =>
            {
                W = 120;
                H = Items.Count * 25;

                int bw = 0;
                foreach (var sub in Items)
                {
                    int w = UI.Font.Width(sub.Text) + 10;
                    if (w > bw)
                    {
                        bw = w;
                    }
                }
                W = bw;
                if (W < 80)
                {
                    W = 80;
                }
                DrawFormSolid(new OpenTK.Vector4(0.2f, 0.2f, 0.2f, 0.7f), -3, -3, W + 6, H + 6);
                DrawForm(BG, new OpenTK.Vector4(0.9f, 0.9f, 0.9f, 0.5f));
                int h = 2;

                foreach (var sub_item in Items)
                {
                    if (OverItem == sub_item)
                    {
                        DrawFormSolid(new OpenTK.Vector4(0.5f, 0.5f, 0.5f, 0.75f), 0, h, W, 25);
                    }
                    DrawText(sub_item.Text, 2, h, new OpenTK.Vector4(1f, 1f, 1f, 0.95f));
                    h = h + 25;
                }

                //DrawItem(GX, GY);
                //    DrawFormSolid(new OpenTK.Vector4(0.2f, 0.2f, 0.2f, 0.9f), -1, -1, W + 2, H + 2);
                //   DrawFormSolid(new OpenTK.Vector4(0.9f, 0.9f, 0.9f,0.9f));
            };
        }