Ejemplo n.º 1
0
    //File dialog is a dialog window that awaits for the user input in the form of selecting an item from the dropdown list. The result is saved in SelectedFile
    public void displayFileDialog(string dialogTitle)
    {
        instance.fileDialogDropdown.ClearOptions();

        //Create placeholder item
        Dropdown.OptionData placeholder = new Dropdown.OptionData();
        placeholder.text = "Select...";

        //Read files from filepanel
        FilePanel fp = new FilePanel();

        instance.fileDialogTitle.text = dialogTitle;
        List <Dropdown.OptionData> items = new List <Dropdown.OptionData>();

        items.Add(placeholder);
        FileInfo[] filenames = fp.ReadFilesInFolder(Application.persistentDataPath + "/", "*.xml");
        foreach (FileInfo x in filenames)
        {
            Dropdown.OptionData dropdowndata = new Dropdown.OptionData();
            dropdowndata.text = x.Name.ToString();
            items.Add(dropdowndata);
        }
        instance.fileDialogDropdown.AddOptions(items);

        instance.FileDialogPanel.SetActive(true);
    }
Ejemplo n.º 2
0
 public void Change(List <CustomFileSystemCover> files, FilePanel activeFilePanel)
 {
     if (ChangeSelected != null)
     {
         ChangeSelected(files, activeFilePanel);
     }
 }
Ejemplo n.º 3
0
        private static void CreateSelected()
        {
            if (filePanels.Count > 0)
            {
                firstSelected = filePanels[0];
            }
            else
            {
                firstSelected = null;
            }

            if (filePanels.Count > 1)
            {
                secondSelected = filePanels[1];
            }
            else
            {
                secondSelected = null;
            }

            if (FilePanelChangeSelect != null)
            {
                FilePanelChangeSelect();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Сохранение визуальных уровней и панелей в шаблон currentTemplate
        /// </summary>
        private void SaveTemplateView()
        {
            this.currentTemplate      = new ViewWindowTemplate();
            this.currentTemplate.Skin = new SkinManager().GetCurrentSkin();
            foreach (var child in spMain.Children)
            {
                if (child.GetType() == typeof(Level))
                {
                    Level         level     = (Level)child;
                    LevelTemplate lTemplate = new LevelTemplate();

                    lTemplate.Height = level.Height;
                    //Перебираем все файловые панели
                    foreach (var c in level.spMain.Children)
                    {
                        if (c.GetType() == typeof(FilePanel))
                        {
                            FilePanel filePanel = (FilePanel)c;

                            FilePanelTemplate fpTemplate = new FilePanelTemplate();
                            fpTemplate.FilePanelSettings = filePanel.FilePanelSettings;
                            //fpTemplate.Width = filePanel.Width;
                            //fpTemplate.Path = filePanel.Path;

                            lTemplate.FilePanels.Add(fpTemplate);
                        }
                    }
                    currentTemplate.Levels.Add(lTemplate);
                }
            }
        }
Ejemplo n.º 5
0
        public static void Remove(FilePanel filePanel)
        {
            filePanels.Remove(filePanel);
            CheckFilePanels();

            CreateSelected();
        }
Ejemplo n.º 6
0
        public static void Remove(FilePanel filePanel)
        {
            filePanels.Remove(filePanel);
            CheckFilePanels();

            CreateSelected();
        }
Ejemplo n.º 7
0
        private void FilePanel_OnItemDrop(FilePanel sender, string fileName)
        {
            Texture2D spriteAtlas = assetManager.GetAsset <Texture2D>(Path.GetFileName(fileName));

            if (spriteAtlas == null)
            {
                FileStream fileStream = new FileStream(fileName, FileMode.Open);
                byte[]     texture    = new byte[fileStream.Length];
                fileStream.Read(texture, 0, (int)fileStream.Length);
                fileStream.Dispose();
                assetManager.SetAsset(Path.GetFileName(fileName), texture);
            }

            GameObject obj = new GameObject();

            obj.transform.Position = WMouse.WorldPosition;
            obj.transform.Size     = new Vector2(64, 32);
            obj.AddChild(new MouseClickableComponent(false));
            obj.AddChild(new DragComponent());
            obj.AddChild(new RawTextureRenderer()
            {
                texture = null, color = Color.White
            });
            world.AddChild(obj);
            obj.GetFirst <RawTextureRenderer>().OnNetworkReady += Obj_OnNetworkReady;
            void Obj_OnNetworkReady(GameObject sender2)
            {
                obj.GetFirst <RawTextureRenderer>().SetTexture(Path.GetFileName(fileName));
            }
        }
Ejemplo n.º 8
0
        protected override void LoadContent()
        {
            spriteBatch   = new SpriteBatch(GraphicsDevice);
            spriteBatchUI = new SpriteBatch(GraphicsDevice);
            UIRect        = Content.Load <Texture2D>("UI");
            arial         = Content.Load <SpriteFont>("arial");

            moveTool  = new Tools.MoveTool();
            scaleTool = new Tools.ScaleTool();

            GameObject btn = new GameObject();

            btn.transform.Position = new Vector2(140, 0);
            btn.transform.Size     = new Vector2(100, 32);
            btn.AddChild(new MouseClickableComponent(true));
            btn.AddChild(new RawTextureRenderer()
            {
                texture = UIRect, color = Color.White
            });
            btn.AddChild(new TextRenderer("MoveTool", Color.Black));
            btn.AddChild(new ButtonComponent());
            btn.GetFirst <MouseClickableComponent>().mouseClickable.OnMouseLeftClickUp += (sender) => ToolSelect(moveTool);
            editorGUI.AddChild(btn);

            GameObject btn2 = new GameObject();

            btn2.transform.Position = new Vector2(240, 0);
            btn2.transform.Size     = new Vector2(100, 32);
            btn2.AddChild(new MouseClickableComponent(true));
            btn2.AddChild(new RawTextureRenderer()
            {
                texture = UIRect, color = Color.White
            });
            btn2.AddChild(new TextRenderer("ScaleTool", Color.Black));
            btn2.AddChild(new ButtonComponent());
            btn2.GetFirst <MouseClickableComponent>().mouseClickable.OnMouseLeftClickUp += (sender) => ToolSelect(scaleTool);
            editorGUI.AddChild(btn2);

            GameObject btn3 = new GameObject();

            btn3.transform.Position = new Vector2(640, 0);
            btn3.transform.Size     = new Vector2(100, 32);
            btn3.AddChild(new MouseClickableComponent(true));
            btn3.AddChild(new RawTextureRenderer()
            {
                texture = UIRect, color = Color.White
            });
            btn3.AddChild(new TextRenderer("Save", Color.Black));
            btn3.AddChild(new ButtonComponent());
            btn3.GetFirst <MouseClickableComponent>().mouseClickable.OnMouseLeftClickUp += SaveButton_Clicked;
            editorGUI.AddChild(btn3);

            FilePanel filePanel = new FilePanel();

            filePanel.transform.Position = new Vector2(0, 0);
            editorGUI.AddChild(filePanel);
            filePanel.OpenDirectory(@"Images/");
            filePanel.OnItemDrop += FilePanel_OnItemDrop;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Displays a custom file menu containing all spreadsheet name from a string.
 /// </summary>
 /// <param name="fileString"></param>
 private void ShowFileMenu(string fileString)
 {
     FilePanel.Show();
     string[] files = fileString.Split('\n');
     foreach (string file in files)
     {
         ListViewItem item = new ListViewItem(file);
         item.Text = file;
         FileList.Items.Add(item);
     }
 }
Ejemplo n.º 10
0
        public static void Add(FilePanel filePanel)
        {
            if (filePanels.Contains(filePanel))
            {
                filePanels.Remove(filePanel);
            }

            filePanels.Insert(0, filePanel);
            CheckFilePanels();
            CreateSelected();
        }
Ejemplo n.º 11
0
        public static void Add(FilePanel filePanel)
        {
            if (filePanels.Contains(filePanel))
            {
                filePanels.Remove(filePanel);
            }

            filePanels.Insert(0, filePanel);
            CheckFilePanels();
            CreateSelected();
        }
Ejemplo n.º 12
0
        private void CreateVisualData()
        {
            FilePanel fpFirst  = null;
            FilePanel fpSecond = null;

            if (FilePanelSelector.FirstSelected != null)
            {
                fpFirst = FilePanelSelector.FirstSelected;
            }
            else
            {
                throw new Exception("Not set FilePanelSelector.FirstSelected");
            }


            if (FilePanelSelector.SecondSelected != null)
            {
                fpSecond = FilePanelSelector.SecondSelected;
            }
            else
            {
                throw new Exception("Not set FilePanelSelector.SecondSelected");
            }

            if (!this.isDroped)
            {
                this.lstCopyFiles = fpFirst.SelectedFiles;
                this.copyPath     = fpSecond.FilePanelSettings.Path;
            }



            lvFromCopy.ItemsSource = this.lstCopyFiles;

            List <string> lstPathes = new List <string>();

            if (this.isDroped)
            {
                lstPathes.Add(this.copyPath);
            }

            foreach (FilePanel fp in FilePanelSelector.FilePanels)
            {
                if (!lstPathes.Contains(fp.FilePanelSettings.Path))
                {
                    lstPathes.Add(fp.FilePanelSettings.Path);
                }
            }
            cbToCopy.ItemsSource = lstPathes;
            cbToCopy.Text        = this.copyPath;
        }
Ejemplo n.º 13
0
        private void Start()
        {
            LoadList();
            FilePanel.SetActive(true);

#if UNITY_ANDROID
            if (Social.localUser.authenticated)
            {
                PlayGamesPlatform.Instance.ReportProgress(GPGSIds.achievement_starting_line_as_a_creator, 100.0f, null);
            }
#elif UNITY_IOS
            Achievementer.ReportProgress("startingline");
#endif
        }
Ejemplo n.º 14
0
        private void ExecutedMakeDirCommand(object sender,
                                            ExecutedRoutedEventArgs e)
        {
            FilePanel fp1 = ExplorerNet.ViewWindowApps.FilePanelApps.FilePanelSelector.FirstSelected;

            if (fp1 != null)
            {
                fp1.MakeNewDirectoryDialog();
            }

            //if (FilePanel.SelectedFilePanel != null)
            //{
            //    FilePanel.SelectedFilePanel.MakeNewDirectoryDialog
        }
Ejemplo n.º 15
0
        private void ExecutedDeleteFilesCommand(object sender,
                                                ExecutedRoutedEventArgs e)
        {
            FilePanel fp1 = ExplorerNet.ViewWindowApps.FilePanelApps.FilePanelSelector.FirstSelected;

            if (fp1 != null)
            {
                fp1.DeleteFilesDialog();
            }

            //if (FilePanel.SelectedFilePanel != null)
            //{
            //    FilePanel.SelectedFilePanel.DeleteFiles();
            //}
        }
Ejemplo n.º 16
0
        /// <summary>
        /// строем отображения уровней и панелей в окне на основе currentTemplate
        /// </summary>
        private void BuildTemplateView()
        {
            spMain.Children.Clear();

            foreach (var levelTemplate in currentTemplate.Levels)
            {
                Level level = new Level();
                level.Height = levelTemplate.Height;

                foreach (var filePanelTemplate in levelTemplate.FilePanels)
                {
                    FilePanel filePanel = new FilePanel();
                    filePanel.filePanel.FilePanelSettings = filePanelTemplate.FilePanelSettings;
                    //filePanel.Width = filePanelTemplate.Width;
                    //filePanel.Path = filePanelTemplate.Path;

                    level.spMain.Children.Add(filePanel);
                }

                spMain.Children.Add(level);
            }
        }
Ejemplo n.º 17
0
 public void Init(string targetUser)
 {
     InitializeComponent();
     this.Activate();
     this.Focus();
     this.Title  = targetUser;
     this.Width  = 400;
     this.Height = 300;
     this.InitTheme();
     _Client        = this.Get <Client>();
     TargetUser     = targetUser;
     _ChatModule    = MainPanel.LoadModule <Chat>(targetUser);
     _SendFilePanel = FilePanel.LoadModule <SendFilePanel>();
     _SendFilePanel.OnSendFileAccepted += new SendFilePanel.SendFileAcceptedHandler((fileDialog, id, length) =>
     {
         Dictionary <string, SortedList <int, byte[]> > SendFile = this.Get <Dictionary <string, SortedList <int, byte[]> > >("SendFile");
         Dictionary <string, string> SendFilePath = this.Get <Dictionary <string, string> >("SendFilePath");
         SendFile[id]     = new SortedList <int, byte[]>();
         SendFilePath[id] = fileDialog.FileName;
         _Client.SendCommand(CommandType.SendFileAccept, targetUser, id);
     });
     _SendFilePanel.OnSendFileRejected += new SendFilePanel.SendFileRejectedHandler(id =>
     {
         _Client.SendCommand(CommandType.SendFileReject, targetUser, id);
     });
     _ChatModule.OnSendMessage += new Chat.SendMessageHandler((chatID, message) =>
     {
         _Client.SendCommand(CommandType.Chat, targetUser, chatID, message);
     });
     _ChatModule.OnSendFile += new Chat.SendFileHandler(fileSending =>
     {
         _SendFilePanel.Append(TargetUser, true, fileSending);
         _Client.SendCommand(CommandType.SendFileRequest, targetUser, fileSending);
     });
     if (_ClientEndPoint == null)
     {
         _Client.SendCommand(CommandType.CheckIP, "SERVER", targetUser);
     }
 }
Ejemplo n.º 18
0
    static void SceneGameObjectsFromJSON()
    {
        List <JSONGameObject> jsonGameObjects = Newtonsoft.Json.JsonConvert.DeserializeObject <List <JSONGameObject> >(FilePanel.Load());

        jsonGameObjects.ToGameObjects();
    }
Ejemplo n.º 19
0
 static void JSONFromSceneGameObjects()
 {
     FilePanel.Save(Newtonsoft.Json.JsonConvert.SerializeObject(GetAllJSONObjectsInScene()), CurrentTime);
 }
Ejemplo n.º 20
0
 private void Awake()
 {
     instance = this;
 }
Ejemplo n.º 21
0
        private static void CreateSelected()
        {
            if (filePanels.Count > 0)
            {
                firstSelected = filePanels[0];

            }
            else
            {
                firstSelected = null;
            }

            if (filePanels.Count > 1)
            {
                secondSelected = filePanels[1];
            }
            else
            {
                secondSelected = null;
            }

            if (FilePanelChangeSelect != null)
            {
                FilePanelChangeSelect();
            }
        }