当前位置: 首页>>代码示例>>C#>>正文


C# Alignment.Remove方法代码示例

本文整理汇总了C#中Gtk.Alignment.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Alignment.Remove方法的具体用法?C# Alignment.Remove怎么用?C# Alignment.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Alignment的用法示例。


在下文中一共展示了Alignment.Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Clicked

        public override void Clicked()
        {
            Treasure.Project = Project;
            Chest.Project = Project;

            Gtk.Window win = new Window(WindowType.Toplevel);
            Alignment warningsContainer = new Alignment(0.1f,0.1f,0f,0f);

            VBox vbox = new VBox();

            var chestGui = new ChestEditorGui(manager);
            chestGui.SetRoom(manager.GetActiveRoom().Index);
            chestGui.Destroyed += (sender2, e2) => win.Destroy();

            Frame chestFrame = new Frame();
            chestFrame.Label = "Chest Data";
            chestFrame.Add(chestGui);

            var treasureGui = new TreasureEditorGui(manager);
            Frame treasureFrame = new Frame();
            treasureFrame.Label = "Treasure Data";
            treasureFrame.Add(treasureGui);

            System.Action UpdateWarnings = () => {
                VBox warningBox = new VBox();
                warningBox.Spacing = 4;

                System.Action<string> AddWarning = (s) => {
                    Image img = new Image(Stock.DialogWarning, IconSize.Button);
                    HBox hb = new HBox();
                    hb.Spacing = 10;
                    hb.Add(img);
                    Gtk.Label l = new Gtk.Label(s);
                    l.LineWrap = true;
                    hb.Add(l);
                    Alignment a = new  Alignment(0,0,0,0);
                    a.Add(hb);
                    warningBox.Add(a);
                };

                foreach (var c in warningsContainer.Children)
                    warningsContainer.Remove(c);

                int index = chestGui.GetTreasureIndex();
                if (index < 0)
                    return;

                if (!Treasure.IndexExists(index)) {
                    AddWarning("Treasure " + Wla.ToWord(index) + " does not exist.");
                }
                else {
                    if (index != treasureGui.Index)
                        AddWarning("Your treasure index is different\nfrom the chest you're editing.");

                    int spawnMode = (Treasure.GetTreasureByte(index, 0) >> 4)&7;

                    if (spawnMode != 3) {
                        AddWarning("Treasure " + Wla.ToWord(index) + " doesn't have spawn\nmode $3 (needed for chests).");
                    }

                    int yx = Chest.GetChestByte(chestGui.RoomIndex, 0);
                    int x=yx&0xf;
                    int y=yx>>4;
                    Room r = Project.GetIndexedDataType<Room>(chestGui.RoomIndex);
                    if (x >= r.Width || y >= r.Height || r.GetTile(x,y) != 0xf1) {
                        AddWarning("There is no chest at coordinates (" + x + "," + y + ").");
                    }
                }

                warningsContainer.Add(warningBox);

                win.ShowAll();
            };

            chestGui.SetTreasureEditor(treasureGui);
            chestGui.ChestChangedEvent += () => {
                UpdateWarnings();
            };
            treasureGui.TreasureChangedEvent += () => {
                UpdateWarnings();
            };

            HBox hbox = new Gtk.HBox();
            hbox.Spacing = 6;
            hbox.Add(chestFrame);
            hbox.Add(treasureFrame);

            Button okButton = new Gtk.Button();
            okButton.UseStock = true;
            okButton.Label = "gtk-ok";
            okButton.Clicked += (a,b) => {
                win.Destroy();
            };

            Alignment buttonAlign = new Alignment(0.5f,0.5f,0f,0f);
            buttonAlign.Add(okButton);

            vbox.Add(hbox);
            vbox.Add(warningsContainer);
            vbox.Add(buttonAlign);
//.........这里部分代码省略.........
开发者ID:Drenn1,项目名称:LynnaLab,代码行数:101,代码来源:ChestEditor.cs

示例2: Clicked

        public override void Clicked()
        {
            Window w = new Window("Maple Appearance Locations");

            var minimapContainer = new Alignment(1.0f,1.0f,1.0f,1.0f);

            ComboBox comboBox = new ComboBox(
                    new string[] {
                    "Present (Ricky)",
                    "Present (Dimitri)",
                    "Present (Moosh)",
                    "Past"
                    });

            comboBox.Changed += (a,b) => {
                int i = comboBox.Active;
                Data data;
                Map map;

                if (i == 3) {
                    data = Project.GetData("maplePastLocations");
                    map = Project.GetIndexedDataType<WorldMap>(1);
                }
                else {
                    data = Project.GetData(Project.GetData("maplePresentLocationsTable", i*2).GetValue(0));
                    map = Project.GetIndexedDataType<WorldMap>(0);
                }

                var minimap = new MyMinimap(data);
                minimap.Width = map.MapWidth;
                minimap.Height = map.MapHeight;

                minimap.SetMap(map);
                minimap.Selectable = false;

                minimapContainer.Remove(minimapContainer.Child);
                minimapContainer.Add(minimap);
                minimapContainer.ShowAll();
            };
            if (manager.GetActiveMap().Group == 1)
                comboBox.Active = 3;
            else
                comboBox.Active = 0;

            VBox vbox = new VBox();
            vbox.Add(comboBox);
            vbox.Add(minimapContainer);

            w.Add(vbox);
            w.ShowAll();
        }
开发者ID:Drenn1,项目名称:LynnaLab,代码行数:51,代码来源:MapleEditor.cs


注:本文中的Gtk.Alignment.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。