public Editor(PckImage curr) { edit = new EditorPanel(curr); buttons = new ButtonPanel(); size = new TrackBar(); size.Minimum=1; size.Maximum=10; InitializeComponent(); Controls.Add(edit); Controls.Add(buttons); Controls.Add(size); buttons.Location = new Point(0,0); buttons.Width = buttons.PreferredWidth; size.Left=buttons.Right; size.Top=buttons.Top; edit.Top=size.Bottom; edit.Left=buttons.Right; ClientSize=new Size(buttons.PreferredWidth+edit.Editor.PreferredWidth, edit.Editor.PreferredHeight+size.Height); palView = new PalView(); palView.Closing+=new CancelEventHandler(palClose); palView.PaletteIndexChanged+=new PaletteClickDelegate(edit.Editor.SelectColor); size.Scroll+=new EventHandler(sizeScroll); }
public void Initialize() { Players.Clear(); OpenedPanel = EditorPanel.None; ((PlayerPanel) Panels[EditorPanel.Player]).Initialize(); ((TurretsPanel) Panels[EditorPanel.Turrets]).Initialize(); ((PowerUpsPanel) Panels[EditorPanel.PowerUps]).Initialize(); ((GeneralPanel) Panels[EditorPanel.General]).Initialize(); ((WavesPanel) Panels[EditorPanel.Waves]).Initialize(); Panels[EditorPanel.Player].SetClickHandler("Lives", DoLives); Panels[EditorPanel.Player].SetClickHandler("Cash", DoCash); Panels[EditorPanel.Player].SetClickHandler("Minerals", DoMinerals); Panels[EditorPanel.Player].SetClickHandler("BulletDamage", DoBulletDamage); Panels[EditorPanel.Player].SetClickHandler("LifePacks", DoLifePacks); Panels[EditorPanel.General].SetClickHandler("Difficulty", DoDifficulty); Panels[EditorPanel.General].SetClickHandler("World", DoWorld); Panels[EditorPanel.General].SetClickHandler("Level", DoLevel); Panels[EditorPanel.Turrets].SetClickHandler(DoTurrets); Panels[EditorPanel.PowerUps].SetClickHandler(DoPowerUps); Panels[EditorPanel.Background].SetClickHandler(DoBackgrounds); Panels[EditorPanel.Waves].SetClickHandler(DoWaves); Panels[EditorPanel.Load].SetClickHandler(DoLoad); Panels[EditorPanel.Delete].SetClickHandler(DoDelete); foreach (var panel in Panels.Values) panel.CloseButtonHandler = DoClosePanel; }
/// <summary> /// 删除实例化的场景物件记录 /// </summary> /// <param name="itemName"></param> public static void RemoveFromList(string itemName) { if (uiItemList.ContainsKey(itemName)) { uiItemList.Remove(itemName); } EditorPanel.RemoveItem(itemName); }
private void button3_Click(object sender, RoutedEventArgs e) { game = new GameWindow(); game.Show(); BoardSerializable gameData = EditorPanel.GetSaveData(); game.LoadData(gameData); game.StartGame(); }
private void Draw() { if (engine.IsGameOpen() && Engine.game.GetCurrentRoom() != null) { engine.Draw(); } else { EditorPanel.Invalidate(); } }
private void SaveDataToFile(object sender, RoutedEventArgs e) { BoardSerializable boardData = EditorPanel.GetSaveData(); using (FileStream saveFile = File.Open(System.IO.Path.Combine(ConfigurationManager.AppSettings["files"], this.Filename.Text), FileMode.Create)) { DataContractSerializer formatter = new DataContractSerializer(typeof(BoardSerializable)); formatter.WriteObject(saveFile, boardData); } LoadFileList(); }
private void initSoundEditor() { _soundEditor = new SoundEditor(EditorPanel); _soundEditor.Parent = EditorPanel; _soundEditor.Visible = true; _soundEditor.Enabled = true; _soundEditor.Dock = DockStyle.Fill; WidthLarge = _soundEditor.Width + WidthSmall; _soundEditor.Parent.Visible = true; _soundEditor.SaveEvent += new SaveWavDelegate(SoundEditor_SaveEvent); EditorPanel.Refresh(); }
protected async Task SaveLocation() { Db.PortDetails.Add(portForm.ToPortDetails()); await Db.SaveChangesAsync(); locations = await Db.Locations.ToArrayAsync(); portsGridView = locations .SelectMany(p => p.Ports) .Where(AreValidRecords) .Select(p => PortDetailsGridView.FromPort(p)) .ToArray(); portForm = new PortDetailsForm(); await EditorPanel.HideAsync(); await SuccessNotification.Show(); }
protected async Task SaveLocation() { Db.PortDetails.Add(portForm.ToPortDetails()); try { await Db.SaveChangesAsync(); } catch (System.Exception) { await FailNotification.Show(); } portsGridView = await LoadPortsViewModel(); portForm = new PortDetailsForm(); await EditorPanel.HideAsync(); await SuccessNotification.Show(); }
private void DrawGizmo(EditorPanel sender) { if (ready) { ImGuizmo.SetOrthographic(_viewportPanel.ProjectioMode == ViewportPanel.ViewMode.Orthographic); _viewportPanel.EnableSelect = !ImGuizmo.IsOver(); ImGuizmo.SetRect(_viewportPanel.WindowContentAreaMin.X, _viewportPanel.WindowContentAreaMin.Y, _viewportPanel.WindowContentAreaMax.X - _viewportPanel.WindowContentAreaMin.X, _viewportPanel.WindowContentAreaMax.Y - _viewportPanel.WindowContentAreaMin.Y); //ref *(float*)(void*)null ImGuizmo.SetDrawlist(); if (ImGuizmo.Manipulate(ref cameraView.M11, ref cameraProjection.M11, currentGizmoOperation, (currentGizmoOperation != OPERATION.SCALE) ? currentGizmoMode : MODE.LOCAL, ref transformMat.M11)) { // safety feature if (!Matrix4x4Extension.HasNaNElement(transformMat)) { Context.ActiveEntity.Transform.SetWorldTransform(transformMat); } } } }
public void Init() { button_style.normal.background = button_up_texture; button_style.active.background = button_down_texture; button_style.normal.textColor = Color.white; button_style.active.textColor = new Color(0.75f, 0.75f, 0.75f); button_style.alignment = TextAnchor.MiddleCenter; button_style.fontSize = 30; remove_style.normal.background = red_button_up_texture; remove_style.active.background = red_button_down_texture; remove_style.normal.textColor = Color.black; remove_style.active.textColor = new Color(0.75f, 0.75f, 0.75f); remove_style.alignment = TextAnchor.MiddleCenter; remove_style.fontSize = 30; code_style.fontSize = 20; code_style.normal.textColor = Color.black; code_style.font = ide_font; code_style.wordWrap = false; shouldPopup = shouldRemove = false; //editorPanel = new Rectangle(0,0,Screen.width*3/4,Screen.height); editorPanel = new EditorPanel(this); editorPanel.setTexture(left_panel_background); //editorPanel.scale((float) 0.5, (float) 0.75); //editorPanel.move(800, 150); errorPanel = new ErrorPanel(this); errorPanel.setTexture(left_panel_background); //errorPanel.scale((float) 2, (float) 0.25); //errorPanel.move(-200, 500); //errorPanel = new Rectangle(Screen.width*3/4+5,0,Screen.width*1/4-5,Screen.height); buttonPanel = new ButtonPanel(this); trashcan = Resources.Load("Crumpled_Paper") as Texture2D; //trashcan.Resize(32, 32); }
public static void Clear() { EditorPanel.Clear(); }
public static void ShowList(LIST_TYPE newType) { listType = newType; Instance.objEditPanel.SetActive(true); int nCount = 0; switch (listType) { case LIST_TYPE.audio_Inner: nCount = audio.lisVideoRes.Count; foreach (string mediaName in audio.lisVideoRes) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); AudioClip clipMp3 = Resources.Load <AudioClip>("Media/" + mediaName); Music music = MusicMgr.PlayMp3(clipMp3); music.gameObject.AddComponent <_Astroid>(); } }); } break; case LIST_TYPE.audio_Url: nCount = audio.lisVideoUrl.Count; foreach (string mediaName in audio.lisVideoUrl) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.audio_Streaming: nCount = audio.lisVideoStreaming.Count; foreach (string mediaName in audio.lisVideoStreaming) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); Instance.StartCoroutine(Instance.LoadMusic(mediaName)); // VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); // theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.video_Inner: nCount = video.lisVideoRes.Count; foreach (string mediaName in video.lisVideoRes) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); VideoClip videoClip = Resources.Load <VideoClip>("Media/" + mediaName); theVideo.Play(videoClip); } }); } break; case LIST_TYPE.video_Url: nCount = video.lisVideoUrl.Count; foreach (string mediaName in video.lisVideoUrl) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.video_Streaming: nCount = video.lisVideoStreaming.Count; foreach (string mediaName in video.lisVideoStreaming) { Button button = EditorPanel.AddItem(mediaName); button.onClick.AddListener(() => { EventMgr.startEvent("显示关闭按钮"); GameObject objLayer = UIMgr.CreateLayer(10); if (objLayer != null) { EditorPanel.Instance.gameObject.SetActive(false); VideoFile theVideo = VideoMgr.CreateVideoPanel("movie", objLayer); theVideo.playUrl(mediaName); } }); } break; case LIST_TYPE.List_None: break; } Vector2 sz = EditorPanel.Instance.parent.GetComponent <RectTransform>().sizeDelta; sz.y += 20; sz.y = nCount * 64; EditorPanel.Instance.parent.GetComponent <RectTransform>().sizeDelta = sz; }
protected async Task CloseEditor() { await EditorPanel.HideAsync(); }
public EditorPanel() { s_instance = this; }
protected async Task OpenEditor() { await EditorPanel.ShowAsync(); }
private void DoExecuteEditorPanelCommand(EditorPanelCommand command) { if (OpenedPanel == EditorPanel.None) // open a panel { OpenedPanel = command.Panel; NotifyEditorCommandExecuted(command); } else if (OpenedPanel == command.Panel) // open a panel that is already opened => close it { var closeCommand = new EditorPanelCommand("ClosePanel", OpenedPanel, false); OpenedPanel = EditorPanel.None; NotifyEditorCommandExecuted(closeCommand); } else if (OpenedPanel != command.Panel && command.Show) // open a panel while another is opened { var closeCommand = new EditorPanelCommand("ClosePanel", OpenedPanel, false); NotifyEditorCommandExecuted(closeCommand); OpenedPanel = command.Panel; NotifyEditorCommandExecuted(command); } }
private void DoClosePanel(PanelWidget widget) { var closeCommand = new EditorPanelCommand("ClosePanel", OpenedPanel, false) { Owner = CurrentOpenedPanelPlayer }; OpenedPanel = EditorPanel.None; NotifyEditorCommandExecuted(closeCommand); }
public void Init() { button_style.normal.background = button_up_texture; button_style.active.background = button_down_texture; button_style.normal.textColor = Color.white; button_style.active.textColor = new Color(0.75f,0.75f,0.75f); button_style.alignment = TextAnchor.MiddleCenter; button_style.fontSize = 30; remove_style.normal.background = red_button_up_texture; remove_style.active.background = red_button_down_texture; remove_style.normal.textColor = Color.black; remove_style.active.textColor = new Color(0.75f,0.75f,0.75f); remove_style.alignment = TextAnchor.MiddleCenter; remove_style.fontSize = 30; code_style.fontSize = 20; code_style.normal.textColor = Color.black; code_style.font = ide_font; code_style.wordWrap = false; shouldPopup = shouldRemove = false; //editorPanel = new Rectangle(0,0,Screen.width*3/4,Screen.height); editorPanel = new EditorPanel(this); editorPanel.setTexture(left_panel_background); //editorPanel.scale((float) 0.5, (float) 0.75); //editorPanel.move(800, 150); errorPanel = new ErrorPanel(this); errorPanel.setTexture(left_panel_background); //errorPanel.scale((float) 2, (float) 0.25); //errorPanel.move(-200, 500); //errorPanel = new Rectangle(Screen.width*3/4+5,0,Screen.width*1/4-5,Screen.height); buttonPanel = new ButtonPanel(this); trashcan = Resources.Load("Crumpled_Paper") as Texture2D; //trashcan.Resize(32, 32); }