예제 #1
0
        public static void BindToListView(PluginInfo[] plugins, ListView control)
        {
            if (plugins == null)
            {
                return;
            }

            foreach (var plugin in plugins)
            {
                var assemblyName            = $"{plugin.AssemblyName.Name}, Version={plugin.AssemblyName.Version}";
                var appDirectoryUri         = new Uri(Assembly.GetExecutingAssembly().Location);
                var assemblyPathUri         = new Uri(plugin.AssemblyPath);
                var relativeAssemblyPathUri = appDirectoryUri.MakeRelativeUri(assemblyPathUri);
                var assemblyPath            = relativeAssemblyPathUri.ToString();

                if (plugin.Loaded)
                {
                    control.AddItem(
                        "Loaded", "Plugin", plugin.Plugin.DisplayName,
                        plugin.Plugin.GetType().FullName, assemblyName, assemblyPath);

                    foreach (var component in plugin.Components)
                    {
                        control.AddItem(
                            "Loaded", "Component", component.DisplayName,
                            component.GetType().FullName, assemblyName, assemblyPath);
                    }
                }
                else
                {
                    control.AddItem(
                        "Failed", "Plugin", "-", "-", assemblyName, assemblyPath);
                }
            }
        }
        private void loadsavepoint(string title, int reward, string loadpath, string info, string[] listtype)
        {
            lblcategory.Text = title;
            rewardbase       = reward;
            listblistedstuff.ClearItems();
            foreach (var item in save.GetValue(loadpath, new string[0]))
            {
                listblistedstuff.AddItem(new ListViewItem {
                    Value = item
                });
            }
            totalguessed  = listblistedstuff.Items.Length;
            level         = (int)Math.Ceiling((totalguessed / 10.0));
            tillnextlevel = Math.Abs(totalguessed - (level * 10));
            if (tillnextlevel == 0)
            {
                level         = level + 1;
                tillnextlevel = 10;
            }

            lblcatedescription.Text    = info;
            Label4.Visible             = false;
            Label3.Visible             = false;
            Label2.Visible             = false;
            Label1.Visible             = false;
            pnlcategorydisplay.Visible = true;
            lbltillnextlevel.Text      = "Words Until Next Level: " + tillnextlevel;
            lblcurrentlevel.Text       = "Current Level: " + level;
            lbltotal.Text      = "Guessed: " + totalguessed + "/" + listtype.Length;
            lblnextreward.Text = "Reward for completing level " + level + " : " + rewardbase * level + "CP";
        }
예제 #3
0
 private void AddBabyItem()
 {
     mResLoader.LoadSync <GameObject>("ItemInfoBabyPrefab")
     .Instantiate()
     .transform
     .Identity()
     .ApplySelfTo(item =>
     {
         itemInfoBaby = item.GetComponent <ItemInfoBaby>();
         itemInfoBaby.SetContent(mUserInfoModel.babyInfoVo);
         listViewVertical.AddItem(item.gameObject);
     });
 }
예제 #4
0
        void GotMidiEventE(object sender, MidiMessageEvent e)
        {
            switch (e.MsgT)
            {
            case MsgType.MetaStr:
                lve.AddItem(c4, MeasureBarTick(e.Ppq), "", MetaHelpers.MetaNameFF(e.IntMsg), GetMetaString(e.Offset), SmfStringFormatter.byteToString(GetMetaStringValue(e.Offset)));
                break;

            case MsgType.MetaInf:
            case MsgType.System:
                lve.AddItem(GetEventColor(e.IntMsg, cR), MeasureBarTick(e.Ppq), "", MetaHelpers.MetaNameFF(e.IntMsg), GetMetaSTR(e.Offset), SmfStringFormatter.byteToString(GetMetaValue(e.Offset)));
                break;

            default:
                if (e.IsRse)
                {
                    lve.AddItem(GetRseEventColor(Colors["225"]), MeasureBarTick(e.Ppq), ch, GetRseEventString(e.Offset), chRseV(e.Offset), SmfStringFormatter.byteToString(GetRseEventValue(e.Offset)));
                }
                else
                {
                    lve.AddItem(GetEventColor(Colors["225"]), MeasureBarTick(e.Ppq), ch, GetEventString(e.Offset), chV(e.Offset), SmfStringFormatter.byteToString(GetEventValue(e.Offset)));
                }
                break;
            }
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.viewport = viewport;
            {
                animationBoard           = new SimpleBox(800, 800);
                animationBoard.BackColor = PixelFarm.Drawing.Color.White;
                viewport.AddContent(animationBoard);
            }
            //
            {
                List <PennerAnimationInfo> pennerAnimationList = LoadAllPennerAnimationList();
                ListView easingFuncs_List = new ListView(200, 850);
                easingFuncs_List.SetLocation(600, 20);
                viewport.AddContent(easingFuncs_List);
                easingFuncs_List.ListItemMouseEvent += (s, e) =>
                {
                    //do animation
                    PennerAnimationInfo animation = pennerAnimationList[easingFuncs_List.SelectedIndex];
                    //
                    GenerateAnimation(animation._generatorDelegate);
                };

                //add item
                foreach (PennerAnimationInfo pennerAnimation in pennerAnimationList)
                {
                    ListItem listItem = new ListItem(200, 20);
                    listItem.Text = pennerAnimation._name;
                    listItem.Tag  = pennerAnimation;
                    easingFuncs_List.AddItem(listItem);
                }
            }
        }
예제 #6
0
        public void InitCanvas()
        {
            canvas = new Canvas();

            ListView listView = new ListView(new Point(20, 20), new Vector2(300, 300), new Point(10, 40), new Vector2(50, 30));
            Button   button   = new Button("Add Item", new Point(400, 20), new Vector2(80, 30), CONTENT_MANAGER.Fonts["default"]);
            Label    label    = new Label("", new Point(400, 60), new Vector2(50, 30), CONTENT_MANAGER.Fonts["default"])
            {
                Origin = new Vector2(-2, -2)
            };

            button.MouseClick += (o, e) =>
            {
                listView.AddItem(count++.ToString());
            };

            listView.ItemSelected += (o, e) =>
            {
                label.Text = e.Text;
                CONTENT_MANAGER.Log(e.Text);
            };

            canvas.AddElement("listView", listView);
            canvas.AddElement("button", button);
            canvas.AddElement("label", label);
        }
예제 #7
0
        void InitBuildingsUI()
        {
            UIBuildingProperties = new Dictionary <UIElement, BuildingProperties>();

            UI.LoadLayoutToElement(UI.Root, ResourceCache, "UI/BuildingsWindow.xml");
            XmlFile buildingStyleXml = ResourceCache.GetXmlFile("UI/BuildingWindow.xml");

            BuildingsList   = UI.Root.GetChild("BuildingsListView", true) as ListView;
            BuildingsWindow = UI.Root.GetChild("BuildingsWindow");
            if (BuildingsList != null)
            {
                foreach (var buildingProperties in BuildingsData.Buildings)
                {
                    var buildingWindow = Helpers.CreateBuildingCreationUIFromProperties(UI, buildingStyleXml, buildingProperties);
                    BuildingsList.AddItem(buildingWindow);

                    UIBuildingProperties.Add(buildingWindow, buildingProperties);

                    var addBuildingButton = buildingWindow.GetChild("CreateButton") as Button;
                    addBuildingButton.Pressed += (o) =>
                    {
                        m_CurrentSelectedTile.AddBuilding(buildingProperties);
                        CloseBuildingSelectionMenu(); // prevent building on same tile
                        OpenBuildingUpgradeMenu(m_CurrentSelectedTile.Building as Building);
                        GameManager.RemoveResourceValue(buildingProperties.ResourceType, buildingProperties.Cost);
                    };

                    addBuildingButton.Enabled = false;
                    addBuildingButton.SetColor(Color.Red);
                }
                BuildingsList.SetScrollBarsVisible(false, false);
            }
            BuildingsWindow.Visible = false;
        }
예제 #8
0
        public CutscenePlayer(WindowSystem _winsys) : base(_winsys)
        {
            Width  = 800;
            Height = 600;
            Title  = "Select Cutscene";
            SetWindowStyle(WindowStyle.DialogNoDrag);
            AddChild(_scroll);
            _scroll.AddChild(_list);

            foreach (var cutscene in _cutscene.Cutscenes)
            {
                _list.AddItem(new ListViewItem
                {
                    Tag   = cutscene,
                    Value = cutscene.Name
                });
            }
            _list.Layout = ListViewLayout.List;
            _list.SelectedIndexChanged += (o, a) =>
            {
                if (_list.SelectedItem != null)
                {
                    _cutscene.Play(_list.SelectedItem.Value);
                    Close();
                }
            };
        }
예제 #9
0
            protected void InitUIElements(Window window,
                                          LineEdit lineEdit,
                                          Button deleteButton,
                                          Button backButton,
                                          ListView fileView)
            {
                this.Window       = window;
                this.LineEdit     = lineEdit;
                this.DeleteButton = deleteButton;
                this.FileView     = fileView;
                this.BackButton   = backButton;
                this.Filename     = "";

                foreach (var nameText in Filenames)
                {
                    FileView.AddItem(nameText.Text);
                    nameText.Text.Visible = true;
                }

                MatchSelected = null;

                LineEdit.Text = "";

                Window.Visible = true;

                LineEdit.TextChanged  += NameEditTextChanged;
                DeleteButton.Pressed  += DeleteButton_Pressed;
                FileView.ItemSelected += OnFileSelected;
                BackButton.Pressed    += BackButton_Pressed;
            }
예제 #10
0
        public static void AddItem(this ListView lstView, string text)
        {
            ListItem listItem = new ListItem(lstView.Width, 20);

            listItem.Text = text;
            lstView.AddItem(listItem);
        }
예제 #11
0
        /// <summary>
        /// Forces re-population of the list of available screen resolutions.
        /// </summary>
        public void PopulateResolutions()
        {
            _resolutions.ClearItems();
            string[] resolutions = _plexgate.GetAvailableResolutions();
            string   defres      = _plexgate.GetSystemResolution();
            string   setres      = _config.GetValue("screenResolution", defres);

            foreach (var res in resolutions)
            {
                var lvitem = new ListViewItem();
                lvitem.Value = res;
                _resolutions.AddItem(lvitem);
            }
            _resolutions.SelectedIndex = Array.IndexOf(_resolutions.Items, _resolutions.Items.FirstOrDefault(x => x.Value == setres));

            _gfxFullscreen.Checked   = _config.GetValue("uiFullscreen", true);
            _audioVolumeSlider.Value = _config.GetValue("audioSfxVolume", 1f);
            _ignoreOpacity.Checked   = _config.GetValue("uiIgnoreControlOpacity", false);
            _fadingWindows.Checked   = _config.GetValue("windowManagerTranslucentWindowsWhileDragging", true);

            _fontSizeList.ClearItems();
            foreach (var name in Enum.GetNames(typeof(PeacenetFontSize)))
            {
                var item = new ListViewItem
                {
                    Value = name,
                    Tag   = (PeacenetFontSize)Enum.Parse(typeof(PeacenetFontSize), name)
                };
                _fontSizeList.AddItem(item);
            }
            var fontsize = _config.GetValue <PeacenetFontSize>("theme.fontsize", PeacenetFontSize.Small);

            _fontSizeList.SelectedIndex = Array.IndexOf(_fontSizeList.Items, _fontSizeList.Items.FirstOrDefault(x => (PeacenetFontSize)x.Tag == fontsize));
            _fontSizeList.Layout        = ListViewLayout.List;
        }
예제 #12
0
        protected override void OnStart(AppHost host)
        {
            _appHost = host;
            {
                _animationBoard           = new Box(800, 800);
                _animationBoard.BackColor = PixelFarm.Drawing.Color.White;
                host.AddChild(_animationBoard);
            }
            //
            {
                List <PennerAnimationInfo> pennerAnimationList = LoadAllPennerAnimationList();
                ListView easingFuncs_List = new ListView(200, 850);
                easingFuncs_List.SetLocation(600, 20);
                host.AddChild(easingFuncs_List);
                easingFuncs_List.ListItemMouseEvent += (s, e) =>
                {
                    //do animation
                    PennerAnimationInfo animation = pennerAnimationList[easingFuncs_List.SelectedIndex];
                    //
                    GenerateAnimation(animation._generatorDelegate);
                };

                //add item
                foreach (PennerAnimationInfo pennerAnimation in pennerAnimationList)
                {
                    ListItem listItem = new ListItem(200, 20);
                    listItem.Text = pennerAnimation._name;
                    listItem.Tag  = pennerAnimation;
                    easingFuncs_List.AddItem(listItem);
                }
            }
        }
예제 #13
0
            void AddItem(GamePackRep gamePack)
            {
                var newItem = new PackageListItem(gamePack, Game);

                newItem.ItemSelected   += ItemSelected;
                newItem.ItemDeselected += ItemDeselected;
                listView.AddItem(newItem);
            }
예제 #14
0
    public void AddGoods(GoodsData data)
    {
        GoodsItem item = Object.Instantiate(goodsItemPrefab).GetComponent <GoodsItem>();

        goodsList.AddItem(item);
        item.SetData(data);
        item.AddValueChangedHandle(OnGoodsItemValueChange);
    }
예제 #15
0
            /// <summary>
            /// Refreshes the list of directories and files.
            /// </summary>
            public void RefreshList()
            {
                // Clear the list.
                _listView.Items.Clear();

                try
                {
                    // Get the string list of directories for the current
                    // directory.
                    string[] dirs = Directory.GetDirectories(
                        Directory.GetCurrentDirectory());

                    // If this is not the root directory of the volume, add a
                    // ".." entry.  In this demo, the root volume is named
                    // "\\ROOT".
                    if (Directory.GetCurrentDirectory() != "\\")
                    {
                        _listView.AddItem("[..]");
                    }

                    // Add each directory name to the list view.
                    for (int i = 0; i < dirs.Length; i++)
                    {
                        _listView.AddItem("[" + dirs[i] + "]");
                    }

                    // Get the string list of files for the current directory.
                    string[] files = Directory.GetFiles(
                        Directory.GetCurrentDirectory());

                    // Add each file name and its information to the list view.
                    for (int i = 0; i < files.Length; i++)
                    {
                        // Get information about the file.
                        FileInfo info = new FileInfo(files[i]);

                        // Add the name, length, and creation date.
                        _listView.AddItem(files[i], info.Length.ToString(),
                                          info.CreationTime.ToString("d"));
                    }
                }
                catch (Exception ex)
                {
                    Debug.Print(ex.ToString());
                }
            }
예제 #16
0
 public void OnCirclesLoaded(string circles)
 {
     string[] tmp = circles.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
     googlePlusContacts = new ContactInfo[tmp.Length];
     for (int i = 0; i < tmp.Length; i++)
     {
         googlePlusContacts[i] = ParseGooglePlusContact(tmp[i]);
         googleCirclesList.AddItem(googlePlusContacts[i]);
     }
 }
예제 #17
0
                public static PlayerItem CreateAndAddToList(ListView list,
                                                            Screen screen,
                                                            PlayerInsignia insignia,
                                                            int initialTeamID,
                                                            PlayerTypeCategory playerTypeCategory)
                {
                    var newItem = new PlayerItem(screen, insignia, initialTeamID, playerTypeCategory);

                    list.AddItem(newItem);
                    newItem.SetStyle("PlayerItem");
                    return(newItem);
                }
예제 #18
0
        public DesktopPanelSettings(WindowSystem _winsys) : base(_winsys)
        {
            Title = "Desktop Panel Settings";
            SetWindowStyle(WindowStyle.Dialog);
            Height = 580;
            Width  = 430;

            AddChild(_apply);
            AddChild(_mainView);
            _mainView.AddChild(_mainPanel);
            _mainPanel.AddChild(_panelThemeListHead);
            _mainPanel.AddChild(_panelThemeListDesc);
            _mainPanel.AddChild(_panelThemeListScroller);
            _panelThemeListScroller.AddChild(_panelThemeList);

            _apply.Text = "Apply";

            _mainPanel.AutoSize = true;

            _mainView.Width  = 400;
            _mainPanel.Width = 400;
            _mainView.X      = 15;
            _mainView.Y      = 15;


            _panelThemeListHead.Text      = "Panel theme";
            _panelThemeListHead.AutoSize  = true;
            _panelThemeListHead.FontStyle = Plex.Engine.Themes.TextFontStyle.Header2;
            _panelThemeListDesc.Text      = "Panel Themes change the look and feel of the desktop panels, panel buttons, and Peacegate Menu button.";
            _panelThemeListDesc.AutoSize  = true;

            _panelThemeListScroller.Height = 192;

            _panelThemeList.Layout = ListViewLayout.List;
            foreach (var theme in _pn.AvailablePanelThemes)
            {
                _panelThemeList.AddItem(new ListViewItem
                {
                    Value = theme.Name,
                    Tag   = theme
                });
            }
            _panelThemeList.SelectedIndex = Array.IndexOf(_pn.AvailablePanelThemes, _pn.PanelTheme);

            _apply.Click += (o, a) =>
            {
                if (_panelThemeList.SelectedItem != null)
                {
                    _pn.PanelTheme = (PanelTheme)_panelThemeList.SelectedItem.Tag;
                }
            };
        }
예제 #19
0
 void OnAddClicked()
 {
     if (m_listView.isVirtual)
     {
         currentList.Add(new GoodsData("新增物品", 555));
         m_listView.itemCount = currentList.Count;
     }
     else
     {
         currentList.Add(new GoodsData("新增物品", 555));
         OnItemRefresh(currentList.Count - 1, m_listView.AddItem());
     }
 }
예제 #20
0
        /// <inheritdoc/>
        public Appearance(WindowSystem _winsys) : base(_winsys)
        {
            _wallpapers      = _plexgate.Content.LoadAllIn <Texture2D>("Desktop");
            _activeWallpaper = _save.GetValue("desktop.wallpaper", "DesktopBackgroundImage2");

            AddChild(_header);
            AddChild(_description);
            AddChild(_wallpaperHeader);
            AddChild(_wallpaperViewer);
            Width  = 675;
            Height = 700;
            Title  = "Appearance Settings";
            foreach (var texture in _wallpapers)
            {
                var pbox = new PictureBox();
                pbox.Texture = texture;
                _wallpaperGrid.AddChild(pbox);
            }
            _wallpaperViewer.AddChild(_wallpaperGrid);
            _wallpaperGrid.SelectedTextureChanged += (texture) =>
            {
                if (texture != null)
                {
                    string name = texture.Name.Remove(0, 8);
                    _save.SetValue("desktop.wallpaper", name);
                    _os.FireWallpaperChanged();
                }
            };

            foreach (var accent in Enum.GetNames(typeof(PeacenetAccentColor)))
            {
                var lvitem = new ListViewItem();
                lvitem.Value = accent;
                lvitem.Tag   = (PeacenetAccentColor)Enum.Parse(typeof(PeacenetAccentColor), accent);
                _accentColors.AddItem(lvitem);
            }
            _accentColors.SelectedIndex         = (int)_save.GetValue("theme.accent", PeacenetAccentColor.Blueberry);
            _accentColors.SelectedIndexChanged += (o, a) =>
            {
                if (_accentColors.SelectedItem == null)
                {
                    return;
                }
                _save.SetValue("theme.accent", (PeacenetAccentColor)_accentColors.SelectedItem.Tag);
                _pn.AccentColor = (PeacenetAccentColor)_accentColors.SelectedItem.Tag;
                Manager.InvalidateAll();
            };
            AddChild(_accentColors);
            AddChild(_accentHeader);
        }
예제 #21
0
        public ThemeChooser(WindowSystem _winsys) : base(_winsys)
        {
            Title           = "Theme chooser";
            _preview.Width  = 448;
            _preview.Height = 252;

            _themeView.Width = 300;
            Width            = (_preview.Width + _themeView.Width) + 40;

            AddChild(_preview);
            AddChild(_themeView);
            _themeView.AddChild(_themeList);

            _themeList.Layout = ListViewLayout.List;

            foreach (var item in _pn.Themes)
            {
                _themeList.AddItem(new ListViewItem
                {
                    Value = item.Name,
                    Tag   = item
                });
            }

            int index = Array.IndexOf(_pn.Themes, _pn.Themes.FirstOrDefault(x => x.ThemeType == _theme.Theme.GetType()));

            _themeList.SelectedIndex = index;

            _apply.Text = "Apply theme";

            AddChild(_apply);
            AddChild(_themeName);
            AddChild(_themeDesc);

            _themeName.AutoSize  = true;
            _themeDesc.AutoSize  = true;
            _themeName.FontStyle = TextFontStyle.Header3;

            _apply.Click += (o, a) =>
            {
                if (_themeList.SelectedItem == null)
                {
                    return;
                }
                var themeinfo = (ThemeInfo)_themeList.SelectedItem.Tag;
                var instance  = (Theme)_plexgate.New(themeinfo.ThemeType);
                _theme.Theme = instance;
            };
        }
예제 #22
0
 /// <summary>
 /// Repopulates the desktop icon list view.
 /// </summary>
 private void SetupIcons()
 {
     _desktopIconsView.ClearItems();
     if (!_fs.DirectoryExists("/home/Desktop"))
     {
         _fs.CreateDirectory("/home/Desktop");
     }
     foreach (var dir in _fs.GetDirectories("/home/Desktop"))
     {
         if (_futils.GetNameFromPath(dir).StartsWith("."))
         {
             continue;
         }
         var diritem = new ListViewItem();
         diritem.Tag      = dir;
         diritem.Value    = _futils.GetNameFromPath(dir);
         diritem.ImageKey = "folder";
         _desktopIconsView.AddItem(diritem);
     }
     foreach (var dir in _fs.GetFiles("/home/Desktop"))
     {
         if (_futils.GetNameFromPath(dir).StartsWith("."))
         {
             continue;
         }
         var diritem = new ListViewItem();
         diritem.Tag      = dir;
         diritem.Value    = _futils.GetNameFromPath(dir);
         diritem.ImageKey = _futils.GetMimeType(dir);
         if (_desktopIconsView.GetImage(diritem.ImageKey) == null)
         {
             _desktopIconsView.SetImage(diritem.ImageKey, _futils.GetMimeIcon(diritem.ImageKey));
         }
         _desktopIconsView.AddItem(diritem);
     }
 }
    void UpdateScoreboard()
    {
        listView.ClearAllItems();
        List <PhotonPlayer> players = PhotonNetwork.playerList
                                      .OrderByDescending(p => p.GetScore())
                                      .ThenBy(p => p.GetDeaths())
                                      .ToList();

        foreach (var player in players)
        {
            Color textColor = playerManager.GetPlayerTextColor(player);
            listView.AddItem(player.name.Colorize(textColor),
                             player.GetScore().ToString("D").Colorize(textColor),
                             player.GetDeaths().ToString("D").Colorize(textColor));
        }
    }
예제 #24
0
 private void AddItem(FamilyModel model)
 {
     mResLoader.LoadSync <GameObject>("ItemInfoFamilySettingPrefab")
     .Instantiate()
     .transform
     .Identity()
     .ApplySelfTo(item =>
     {
         ItemFamilySetting itemFamilySetting = item.GetComponent <ItemFamilySetting>();
         itemFamilySetting.SetContent(model, mData.type);
         itemFamilySetting.Toggle.group = mToggleGroup;
         itemFamilySetting.Toggle.onValueChanged.AddListener((bool value) =>
                                                             OnToggleClick(model, value));
         listViewVertical.AddItem(item.gameObject);
     });
 }
예제 #25
0
    private void AddItem(ListView lv, DemoItem prefab)
    {
        var color = new Color()
        {
            r = Random.Range(0.0f, 1.0f),
            g = Random.Range(0.0f, 1.0f),
            b = Random.Range(0.0f, 1.0f),
            a = 1.0f,
        };

        var item = Instantiate(prefab);

        item.SetContent(color.ToString(), color);

        lv.AddItem(item.gameObject);
    }
예제 #26
0
        public static void BindToListView(IList <FeatureGroup> featureGroups, ListView control)
        {
            using (control.UpdateScope())
            {
                control.Items.Clear();

                foreach (var featureGroup in featureGroups)
                {
                    control.AddItem(
                        featureGroup.Source.DisplayName,
                        string.Join(", ", featureGroup.Elements.Select(x => x.DisplayName)),
                        featureGroup.ValueType.ToString(),
                        featureGroup.CompressionFunction?.DisplayName ?? string.Empty,
                        featureGroup.CompressionElements != null
                            ? string.Join(", ", featureGroup.CompressionElements.Select(x => x.DisplayName))
                            : string.Empty,
                        featureGroup.AggregationFunction?.DisplayName ?? string.Empty);
                }
            }
        }
예제 #27
0
    private void RefreshUI()
    {
        //clear all the quest lists
        MainQuestList.Clear();
        SideQuestList.Clear();

        //init all the quest lists again
        foreach (var define in DataManager.Instance.Quests.Values)
        {
            GameObject    obj  = Instantiate(ListItemPrefab);
            QuestListItem item = obj.GetComponent <QuestListItem>();
            item.Init(define);

            if (define.Type == QuestDefine.E_QuestType.MAIN)
            {
                MainQuestList.AddItem(item);
            }
            else
            {
                SideQuestList.AddItem(item);
            }
        }
    }
예제 #28
0
    private void OnFoundDevice(CommDevice device)
    {
        ListItem item = GameObject.Instantiate(deviceItem);

        item.gameObject.SetActive(true);
        item.textList[0].text = device.name;
        if (item.textList.Length > 1)
        {
            item.textList[1].text = device.address;
        }
        item.data = device;

        deviceList.AddItem(item);

        if (deviceList.selectedItem == null && hm10.device != null)
        {
            if (hm10.device.Equals(device))
            {
                deviceList.selectedItem = item;
                ok.interactable         = true;
            }
        }
    }
예제 #29
0
            bool LoadDirectory(string relativeDirPath)
            {
                string absoluteDirPath = Path.Combine(baseDir, relativeDirPath);
                var    newEntries      = new List <NameTextPair>();

                try {
                    foreach (var file in Game.Files.GetFSEntriesInDirectory(absoluteDirPath, true, false))
                    {
                        newEntries.Add(new NameTextPair(Game, Path.GetFileName(file), false));
                    }

                    foreach (var directory in Game.Files.GetFSEntriesInDirectory(absoluteDirPath, false, true))
                    {
                        newEntries.Add(new NameTextPair(Game, Path.GetFileName(directory), true));
                    }
                }
                catch (IOException) {
                    return(false);
                }

                currentDirectory = relativeDirPath;
                ClearFileView();

                cDirEntries = newEntries;
                cDirEntries.Sort();

                if (absoluteDirPath != baseDir)
                {
                    cDirEntries.Insert(0, new NameTextPair(Game, "..", true));
                }

                foreach (var entry in cDirEntries)
                {
                    fileView.AddItem(entry.Text);
                }
                return(true);
            }
예제 #30
0
        /// <summary>
        /// Creates a new instance of the <see cref="MissionMenu"/> window.
        /// </summary>
        /// <param name="_winsys">The window manager associated with this <see cref="Window"/>.</param>
        public MissionMenu(WindowSystem _winsys) : base(_winsys)
        {
            Width  = 720;
            Height = 550;
            SetWindowStyle(WindowStyle.Dialog);
            Title = "Missions";
            if (_missionManager.IsPlayingMission)
            {
                _state    = 2;
                _selected = _missionManager.CurrentMission;
            }
            else
            {
                if (_missionManager.Missions.Length == 1)
                {
                    _state    = 1;
                    _selected = _missionManager.Missions[0];
                }
                else
                {
                    _state = 0;
                }
            }

            AddChild(_missionsHead);
            AddChild(_missionsDesc);
            AddChild(_missionsView);

            _currentView.AddChild(_currentHead);
            _currentView.AddChild(_currentDesc);
            _currentView.AddChild(_startMission);

            foreach (var mission in _missionManager.Missions)
            {
                var lvitem = new ListViewItem();
                lvitem.Value = mission.Name;
                lvitem.Tag   = mission;
                _availableView.AddItem(lvitem);
            }

            _availableView.Layout = ListViewLayout.List;

            _availableView.SelectedIndexChanged += (o, a) =>
            {
                if (_availableView.SelectedItem != null)
                {
                    _state    = 1;
                    _selected = _availableView.SelectedItem.Tag as Mission;
                    ResetUI();
                }
            };

            _missionsHead.AutoSize  = true;
            _missionsHead.FontStyle = Plex.Engine.Themes.TextFontStyle.Header1;
            _missionsDesc.AutoSize  = true;
            _currentView.AutoSize   = true;
            _currentHead.AutoSize   = true;
            _currentHead.FontStyle  = Plex.Engine.Themes.TextFontStyle.Header3;
            _currentDesc.AutoSize   = true;

            _startMission.Click += (o, a) =>
            {
                if (_state == 1)
                {
                    _missionManager.StartMission(_selected);
                    Close();
                }
                else if (_state == 2)
                {
                    _infobox.ShowYesNo("Abandon mission", "Are you sure you'd like to abandon this mission? Anything you've said on your disk since the start of the mission will be lost!", (answer) =>
                    {
                        if (answer)
                        {
                            _missionManager.AbandonMission();
                            Close();
                        }
                    });
                }
            };

            ResetUI();
        }