public override void Draw(UISpriteBatch batch) { var res = EditorResource.Get(); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(), new Vector2(batch.GraphicsDevice.Viewport.Width, 30), new Color(12, 61, 112) * 0.80f); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(0, 30), new Vector2(batch.GraphicsDevice.Viewport.Width, 4), new Color(12, 61, 112) * 0.30f); }
public void StartIDE(VM vm) { if (MainWindow.Instance == null) { EditorResource.Get().Init(GameFacade.GraphicsDevice); var content = Content.Content.Get(); EditorScope.Behaviour = new Files.Formats.IFF.IffFile( content.TS1 ? Path.Combine(content.TS1BasePath, "GameData/Behavior.iff") : content.GetPath("objectdata/globals/behavior.iff")); EditorScope.Globals = content.WorldObjectGlobals.Get("global"); Program.MainThread = Thread.CurrentThread; var t = new Thread(() => { var editor = new MainWindow(); editor.SwitchVM(vm); Application.Run(editor); }); //t.SetApartmentState(ApartmentState.STA); t.Start(); } else { var inst = MainWindow.Instance; inst.BeginInvoke(new Action(() => { inst.SwitchVM(vm); inst.Show(); })); } }
public void NewBreak(VMStackFrame frame) { DebugGo.Tooltip = "Go"; DebugGo.Texture = EditorResource.Get().Indexed[0]; DebugStepIn.Disabled = false; DebugStepOut.Disabled = false; DebugStepOver.Disabled = false; DebugTrue.Disabled = false; DebugFalse.Disabled = false; var breakStr = frame.Thread.ThreadBreakString ?? "Stopped."; bool isException = breakStr[0] == '!'; if (isException) { DebugLabel.CaptionStyle.Color = new Color(255, 255, 155, 255); breakStr = breakStr.Substring(1); } else { DebugLabel.CaptionStyle.Color = Color.White; } DebugLabel.Caption = breakStr; RedrawNext = true; DebugFrame = frame; UpdateDebugPointer(DebugFrame); }
public void ShadDraw(UISpriteBatch batch) { var res = EditorResource.Get(); if (Style == null || Style.Background.A > 200) { DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(5, 5), new Vector2(Width, Height), ShadCol); } else { DrawTiledTexture(batch, res.DiagTile, new Rectangle(5, 5, Width, Height), ShadCol); } if (Type == PrimBoxType.Primitive) { int topInd = 0; if (Instruction.Breakpoint) { DrawLocalTexture(batch, res.Breakpoint, null, new Vector2(-15, 6 + ((topInd++) * 18)), new Vector2(1, 1), Color.Black * 0.2f); } if (Master.DebugPointer == this) { DrawLocalTexture(batch, res.CurrentArrow, null, new Vector2(-15, 6 + ((topInd++) * 18)), new Vector2(1, 1), Color.Black * 0.2f); } } foreach (var child in Nodes) { child.ShadDraw(batch); } }
public void Draw() { //var h = 18; //var d = showContent ? 2 : 0; //var r = GUILayoutUtility.GetRect(Screen.width-18f, 18); GUILayout.Box("", GUIStyle.none, GUILayout.Height(16f)); var r = GUILayoutUtility.GetLastRect(); //if (showContent) GUI.Box(r.AddHeight(-5),""); /*GUILayout.BeginHorizontal(); * //var r = GUILayoutUtility.GetRect(20, 20); * //GUI.DrawTexture(r, vlbGUISkin.icoEye(showContent)); * if (GUILayout.Button(vlbGUISkin.icoEye(showContent), EditorStyles.label)) { * showContent = !showContent; * } * * activeIdx = GUILayout.Toolbar(activeIdx, TabList); * GUILayout.FlexibleSpace(); * GUILayout.EndHorizontal();*/ if (showContent) { TabDrawer[activeIdx](); } if (GUI.Button(r.w(20f).dx(2).dy(1), EditorResource.GetTexture2D("eye"), EditorStyles.label)) { showContent = !showContent; } activeIdx = GUI.Toolbar(r.dx(25).dw(-3).dh(0), activeIdx, TabList); }
void OnEnable() { if (!texLoaded) { tex_orb = EditorResource.LoadEditorTexture("am_orb"); texLoaded = true; } window = this; this.maxSize = new Vector2(715f, 398f); this.minSize = this.maxSize; this.wantsMouseMove = true; loadAnimatorData(); setupFilteredCategories(); selectedIndex = getCategoryIndexForEase(TimelineWindow.GetEaseTypeNameIndex(key.easeType)); if (getSelectedEaseName(category, selectedIndex) == "Custom") { isCustomEase = true; } if (isCustomEase && key.customEase.Count > 0) { curve = key.getCustomEaseCurve(); } else { setEasingCurve(); } }
static internal void Draw(h2Info info, Rect r, GameObject go) { if (h2Info.SelectionCount < 2) { return; } var idx = Array.IndexOf(h2Info.SelectedInstIDs, info.instID); if (idx == -1) { return; } using (GuiX.GUIColor(go == Selection.activeGameObject ? Color.red : Color.white)) { GUI.DrawTexture(r, EditorResource.GetTexture2D("circle")); } if (r.xLMB_isDown().noModifier) { //var instList = Selection.instanceIDs; Selection.activeInstanceID = go.GetInstanceID(); Selection.instanceIDs = h2Info.SelectedInstIDs; } }
public override void Draw(UISpriteBatch batch) { base.Draw(batch); if (!Visible) { return; } Vector2 dir = new Vector2(); var res = EditorResource.Get(); if (MouseDrag || Destination != null) { //draw Line bg dir = new Vector2(ArrowVec.X, ArrowVec.Y); dir.Normalize(); DrawLine(res.WhiteTex, dir * 10, ArrowVec - dir * 5, batch, 6, Color.White); } //draw Node DrawLocalTexture(batch, res.NodeOutline, new Vector2(res.NodeOutline.Width / -2, res.NodeOutline.Height / -2)); DrawLocalTexture(batch, res.Node, null, new Vector2(res.Node.Width / -2, res.Node.Height / -2), new Vector2(1f, 1f), NodeColors[Type]); if (MouseDrag || Destination != null) { //draw Arrow var arrowDir = (float)Math.Atan2(-dir.X, dir.Y); var arrowPos = LocalPoint(ArrowVec); batch.Draw(res.ArrowHeadOutline, arrowPos, null, Color.White, arrowDir, new Vector2(9, 19), _Scale, SpriteEffects.None, 0); batch.Draw(res.ArrowHead, arrowPos, null, NodeColors[Type], arrowDir, new Vector2(9, 19), _Scale, SpriteEffects.None, 0); //draw Line DrawLine(res.WhiteTex, dir * 10, ArrowVec - dir * 5, batch, 4, NodeColors[Type]); } Texture2D icon; switch (Type) { case NodeType.False: icon = res.FalseNode; break; case NodeType.True: icon = res.TrueNode; break; default: icon = res.DoneNode; break; } DrawLocalTexture(batch, icon, IconPos[Direction] - new Vector2(icon.Width / 2, icon.Height / 2)); var shadRect = SmallShad[Direction]; DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(shadRect.X, shadRect.Y), new Vector2(shadRect.Width, shadRect.Height), Color.Black * 0.15f); }
/*public static Rect xDrawSubLabel(this Rect r, string title, bool left = true, Vector2? offset = null, GUIStyle style = null) { * if (style == null) style = EditorStyles.label; * var w = style.CalcSize(new GUIContent(title)).x; * GUI.Label(r.xExtractSub(w, out r, left, offset), title, style); * return r; * }*/ public static Rect xDrawL_Arrow(this Rect r, ref bool isExpand, float dx = 0f, float dy = 2f, Color?c = null) { using (GuiX.GUIColor(c != null ? c.Value : ColorHSL.gray.xProSkinAdjust())) { var subRect = r.xExtractSub(16f, out r).h(16f).dx(dx).dy(dy); GUI.DrawTexture(subRect, EditorResource.GetTexture2D(isExpand ? "arrow_d" : "arrow_r")); if (subRect.xLMB_isDown().noModifier) { isExpand = !isExpand; } } return(r); }
internal h2Static() { texList = new[] { EditorResource.GetTexture2D("lighting"), EditorResource.GetTexture2D("lighting") }; texColor = new[] { h2Color.Get(h2ColorType.NotStatic), h2Color.Get(h2ColorType.Static) }; }
internal h2Lock() { texList = new[] { EditorResource.GetTexture2D("lock_dis"), EditorResource.GetTexture2D("lock") }; texColor = new[] { h2Color.Get(h2ColorType.Unlock), h2Color.Get(h2ColorType.Lock) }; }
public override void Draw(UISpriteBatch batch) { var res = EditorResource.Get(); DrawTiledTexture(batch, res.Background, new Rectangle((int)Math.Floor(this.Position.X / -200) * 200, (int)Math.Floor(this.Position.Y / -200) * 200, batch.Width + 200, batch.Height + 200), Color.White); foreach (var child in Primitives) { child.ShadDraw(batch); } base.Draw(batch); }
public void StartIDE(VM vm) { EditorResource.Get().Init(GameFacade.GraphicsDevice); EditorScope.Behaviour = new Files.Formats.IFF.IffFile(Content.Content.Get().GetPath("objectdata/globals/behavior.iff")); EditorScope.Globals = FSO.Content.Content.Get().WorldObjectGlobals.Get("global"); var t = new Thread(() => { var editor = new MainWindow(); editor.Test(vm); Application.Run(editor); }); //t.SetApartmentState(ApartmentState.STA); t.Start(); }
public void Resume() { DebugGo.Tooltip = "Pause"; DebugGo.Texture = EditorResource.Get().Indexed[7]; DebugStepIn.Disabled = true; DebugStepOut.Disabled = true; DebugStepOver.Disabled = true; DebugTrue.Disabled = true; DebugFalse.Disabled = true; DebugLabel.Caption = "Running..."; RedrawNext = true; if (DisableDebugger != null) { DisableDebugger(); } BHAVView.DebugPointer = null; }
/*public static void xDrawTextureColor(this Rect r, Texture2D tex, Color c) { * var oColor = GUI.color; * GUI.color = c; * GUI.DrawTexture(r, tex); * GUI.color = oColor; * * if (r.xLMB_isDown().noModifier) { * EditorGUIUtility.DrawColorSwatch(r.dy(20f).w(200), c); * } * } * * * * public static Rect xDrawBar(Color? c = null) { * var rect = GUILayoutUtility.GetRect(0, Screen.width, 20f, 20f); * xDrawBar(rect); * return rect; * } * * public static Rect xDrawBar(this Rect r) { * GUI.DrawTexture(r, c.xGetTexture2D()); * return r; * } * * public static Rect xDrawTitleBar(string title, float lbOffset = 0, Vector4? padding = null) { * * return xDrawTitleBar(r, title, lbOffset, padding); * } * * public static Rect xDrawTitleBar(Rect r, string title, float lbOffset = 0, Vector4? padding = null) { * if (padding != null) r = r.xOffset(padding.Value); * var c = _titleBarColor; * * GUI.DrawTexture(r, c.xGetTexture2D()); * GUI.Label(r.dy(2f).dx(lbOffset), title, EditorStyles.boldLabel); * return r; * } * public static Rect xDrawSub(this Rect r, Action<Rect> drawer, float w, bool left = true, float offset = 0) { * Rect subRect; * r = left ? r.xLeft(out subRect, w) : r.xRight(out subRect, w); * drawer(subRect.dx(offset)); * return r; * } * * public static Rect xDrawSubArrow(this Rect r, ref bool isExpand, bool left = true, float dx = 0, Color? c = null) { * var expand = isExpand; * * r = r.xDrawSub(subRect => { * using (GUIColor(c != null ? c.Value : ColorHSL.gray.xProSkinAdjust())) { * var drawRect = subRect.wh(16f, 16f).dy(2f); * GUI.DrawTexture(drawRect, EditorResource.GetTexture2D(expand ? "arrow_d" : "arrow_r")); * } * * if (subRect.xLMB_isDown().noModifier) { * expand = !expand; * } * }, 16f); * * isExpand = expand; * return r; * } * * public static Rect xDrawSubToggle(this Rect r, ref bool isEnable, bool left = true, float dx = 0f) { * var enable = isEnable; * * r = r.xDrawSub(subRect => { * enable = GUI.Toggle(subRect, enable, ""); * }, 16f); * * isEnable = enable; * return r; * } * * public static Rect xDrawSubLabel(this Rect r, string label, GUIStyle style = null, bool left = true, float w = 0f, float dx = 0f) { * if (w == 0) { * if (style == null) style = EditorStyles.label; * w = style.CalcSize(new GUIContent(label)).x; * } * * r = r.xDrawSub(subRect => { * GUI.Label(subRect, label, style); * }, w); * return r; * }*/ /*public static void xDrawTitleBar(Rect r, string title, float barDx = 0f) { * var c = _titleBarColor; * GUI.DrawTexture(r.dx(barDx), c.xGetTexture2D()); * GUI.Label(r.dy(2f), title, EditorStyles.boldLabel); * } * * public static bool xDrawTitleBar(string title, float titleDx = 0f, Rect? padding = null, bool? isExpand = null) { * var r = GUILayoutUtility.GetRect(0, Screen.width, 20f, 20f); * var c = _titleBarColor; * * if (padding != null) r = r.xAdd(padding.Value); * * GUI.DrawTexture(r, c.xGetTexture2D()); * if (isExpand != null) { * var arrowRect = r.dy(2).wh(16f, 16f); * using (GUIColor(ColorHSL.gray.xProSkinAdjust())) { * GUI.DrawTexture(arrowRect, EditorResource.GetTexture2D(isExpand.Value ? "arrow_d" : "arrow_r")); * } * * if (arrowRect.xLMB_isDown().noModifier) { * isExpand = !isExpand.Value; * } * * GUI.Label(r.dy(2f).dx(titleDx + 10f), title, EditorStyles.boldLabel); * return isExpand.Value; * } * * GUI.Label(r.dy(2f).dx(titleDx), title, EditorStyles.boldLabel); * return true; * } * * public static void xDrawTitleBar(string title, ref bool enable, float barDx = 0f, float toggleDx = 0f) { * var r = GUILayoutUtility.GetRect(0, Screen.width, 20f, 20f); * var c = _titleBarColor; * * GUI.DrawTexture(r.dx(barDx), c.xGetTexture2D()); * * var r2 = r.dy(2f); * GUI.Label(r2, title, EditorStyles.boldLabel); * enable = GUI.Toggle(r2.xSubRectRight(20f).dx(toggleDx), enable, ""); * }*/ public static void DrawResource(ref string[] icons, ref Color[] colors) { var rr = GUILayoutUtility.GetRect(80, 20f).wh(80f, 20f).xHzSplitByWeight(1, 1, 1, 1); Color light = new Color32(192, 192, 192, 255); Color dark = new Color32(49, 49, 49, 255); GUI.DrawTexture(rr[0].w(40f), dark.xGetTexture2D()); GUI.DrawTexture(rr[0].dx(40f).w(40f), light.xGetTexture2D()); var oColor = GUI.color; for (var i = 0; i < icons.Length; i++) { GUI.color = colors[i]; GUI.DrawTexture(rr[i].wh(16f, 16f), EditorResource.GetTexture2D(icons[i])); } GUI.color = oColor; }
public override void Draw(UISpriteBatch batch) { base.Draw(batch); var res = EditorResource.Get(); if (Type == PrimBoxType.Primitive) { if (InstPtr == 0) { DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(-3, -3), new Vector2(Width + 6, Height + 6), new Color(0x96, 0xFF, 0x73)); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(-2, -2), new Vector2(Width + 4, Height + 4), new Color(0x46, 0x8C, 0x00)); //start point green } if (Style.Background.A > 200) { DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(), new Vector2(Width, Height), Master.Selected.Contains(this)?Color.Red:Color.White); //white outline } DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(1, 1), new Vector2(Width - 2, Height - 2), Style.Background); //background DrawTiledTexture(batch, res.DiagTile, new Rectangle(1, 1, Width - 2, Height - 2), Color.White * Style.DiagBrightness); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(1, 1), new Vector2(Width - 2, 20), Color.White * 0.66f); //title bg Title.Draw(batch); if (BodyTextLabels != null) { TextRenderer.DrawText(BodyTextLabels.DrawingCommands, this, batch); } int topInd = 0; if (Instruction.Breakpoint) { DrawLocalTexture(batch, res.Breakpoint, null, new Vector2(-20, 1 + ((topInd++) * 18)), new Vector2(1, 1), Color.White); } if (Master.DebugPointer == this) { DrawLocalTexture(batch, res.CurrentArrow, null, new Vector2(-20, 1 + ((topInd++) * 18)), new Vector2(1, 1), Color.White); } } else { DrawLocalTexture(batch, (Type == PrimBoxType.True)?res.TrueReturn:res.FalseReturn, new Vector2()); } }
internal h2Active() { texList = new[] { EditorResource.GetTexture2D("eye_dis"), EditorResource.GetTexture2D("eye"), EditorResource.GetTexture2D("eye_dis") }; texColorOrg = new [] { h2Color.Get(h2ColorType.NotActive), h2Color.Get(h2ColorType.Active), h2Color.Get(h2ColorType.ActiveHalf) }; texColorChanged = new[] { h2Color.Get(h2ColorType.NotActiveChanged), h2Color.Get(h2ColorType.ActiveChanged), h2Color.Get(h2ColorType.ActiveHalfChanged), }; texColor = texColorOrg; h2Shortcut.Add(h2Shortcut.TOGGLE_ACTIVE, () => { var selection = h2Info.SelectedGameObjects; var activeGO = Selection.activeGameObject; var value = !activeGO.activeSelf; if (selection.Length > 1) { Undo.RecordObjects(selection, "Toggle Active"); foreach (var go in selection) { go.SetActive(value); } } else { activeGO.hToggleActive(true); } }); }
public override void Draw(UISpriteBatch batch) { var width = batch.GraphicsDevice.Viewport.Width; var height = batch.GraphicsDevice.Viewport.Height; BHAVView.Width = width; BHAVView.Height = height; base.Draw(batch); if (Placement != null) { Placement.PreDraw(batch); Placement.ShadDraw(batch); Placement.Draw(batch); } var res = EditorResource.Get(); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(), new Vector2(4, height), Color.Black * 0.2f); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(4, 0), new Vector2(width, 4), Color.Black * 0.2f); if (DebugMode) { if (width != LastWidth) { DebugTrue.Position = new Vector2(width - 80, 5); DebugFalse.Position = new Vector2(width - 55, 5); DebugReset.Position = new Vector2(width - 30, 5); GameThread.NextUpdate(x => Invalidate()); } } if (Placement != null) { DrawCutoutLines(CutoutPhase, 5, Color.Black * 0.2f, batch); DrawCutoutLines(CutoutPhase, 0, new Color(0, 102, 26), batch); } LastWidth = width; LastHeight = height; }
public override void Draw(UISpriteBatch batch) { base.Draw(batch); if (Placement != null) { Placement.ShadDraw(batch); Placement.Draw(batch); } var res = EditorResource.Get(); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(), new Vector2(4, batch.Height), Color.Black * 0.2f); DrawLocalTexture(batch, res.WhiteTex, null, new Vector2(4, 0), new Vector2(batch.Width, 4), Color.Black * 0.2f); if (Placement != null) { DrawCutoutLines(CutoutPhase, 5, Color.Black * 0.2f, batch); DrawCutoutLines(CutoutPhase, 0, new Color(0, 102, 26), batch); } LastWidth = batch.Width; LastHeight = batch.Height; }
virtual protected void Draw(Rect rect, GameObject ptarget, string icon, Color?c = null) { target = ptarget; if (string.IsNullOrEmpty(icon)) { return; } if (c == null) { c = (Get(ptarget) ? ColorHSL.yellow.dS(-0.2f).xProSkinAdjust() : ColorHSL.gray.xProSkinAdjust()); } using (GuiX.GUIColor(c.Value)) { GUI.DrawTexture(rect, EditorResource.GetTexture2D(icon)); } if (rect.Contains(Event.current.mousePosition)) { d = 0; ReadModifier().ReadMouse().Check(); } }
public void Draw(Action <int, int, string> onReorder = null, Action <string, string, int> onRename = null, Action <string, int, vlbGUIList <string> > OnRightClick = null, Rect?drawRect = null) { _needRepaint = false; //isExpand = GuiX.xDrawTitleBar(title, 5f, null, isExpand); GDrawX.Bar().xDrawL_Arrow(ref isExpand) .xDrawL_BoldLabel(title) .xDrawSub(subRect => { using (GuiX.DisableGroup(editIndex != -1)) { if (subRect.dy(2f).xMiniButton("+", false)) { list.Add(""); editIndex = drawer.CacheList.Count - 1; editName = ""; isExpand = true; _needRepaint = true; } } }, 16f, false, new Vector2(-2f, 0f)); //var rAdd = GUILayoutUtility.GetLastRect().xAdjustTL(16).dy(2f).dw(-2f); //if (rAdd.xMiniButton("+", false)) { // list.Add(""); // editIndex = drawer.CacheList.Count - 1; // editName = ""; // isExpand = true; // _needRepaint = true; //} if (isExpand) { drawer.Draw((r, v, idx) => { //if (idx == 0) Debug.Log("d2StringGUI " + idx + ":" + r); if (idx == editIndex) { RenameGUI(r); } else { var v1 = EditorGUI.TextField(r.dw(-20f).dt(2f), v); if (v1 != v) { list[idx] = v1; if (onRename != null) { onRename(v, v1, idx); } } //Debug.Log(Event.current + ":" + r.Contains(Event.current.mousePosition) + ":" + GUI.GetNameOfFocusedControl //remove focus when click outside if (GUI.GetNameOfFocusedControl() == focusName && !r.Contains(Event.current.mousePosition) && Event.current.type == EventType.mouseDown) { GUI.FocusControl(null); _needRepaint = true; } /*EditorGUI.LabelField(r.dl(r.width - 80f).dw(-10f).dt(2f).db(-2f), "" + depth * idx, * GuiX.miniLabelGrayStyle);*/ } //if (v != "Default") { // Can not remove group / Stacks Default var remRect = r.xSubRectRight(16f).dx(-4f); GUI.DrawTexture(remRect, EditorResource.GetTexture2D("remove")); if (remRect.xLMB_isDown().noModifier) { //updateComponent(v, null); if (editIndex == idx) { editIndex = -1; } list.RemoveAt(idx); _needRepaint = true; } //} return(18); }, onReorder, OnRightClick, null, drawRect); } }
public override void Read(AssetReader reader) { base.Read(reader); if (IsReadLoadType(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); Channels = reader.ReadInt32(); Frequency = reader.ReadInt32(); BitsPerSample = reader.ReadInt32(); Length = reader.ReadSingle(); if (IsReadIsTrackerFormat(reader.Version)) { IsTrackerFormat = reader.ReadBoolean(); } if (IsReadAmbisonic(reader.Version)) { Ambisonic = reader.ReadBoolean(); } if (IsAlignTrackerFormat(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsReadAudioClipFlags(reader.Version)) { AudioClipFlags = reader.ReadInt32(); } if (IsReadFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } SubsoundIndex = reader.ReadInt32(); PreloadAudioData = reader.ReadBoolean(); LoadInBackground = reader.ReadBoolean(); Legacy3D = reader.ReadBoolean(); reader.AlignStream(AlignType.Align4); if (!IsReadFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } if (IsReadType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (IsReadCompressionFormat(reader.Version)) { CompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } reader.AlignStream(AlignType.Align4); #if UNIVERSAL if (IsReadEditorResource(reader.Flags)) { EditorResource.Read(reader); if (IsReadCompressionFormat(reader.Version)) { EditorCompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } } #endif } else { if (IsReadDecompressOnLoadFirst(reader.Version)) { DecompressOnLoad = reader.ReadBoolean(); } Format = (FMODSoundFormat)reader.ReadInt32(); if (IsReadType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (IsReadLength(reader.Version)) { Length = reader.ReadSingle(); Frequency = reader.ReadInt32(); Size = reader.ReadInt32(); } if (IsReadDecompressOnLoadSecond(reader.Version)) { DecompressOnLoad = reader.ReadBoolean(); } if (IsRead3D(reader.Version)) { Legacy3D = reader.ReadBoolean(); } if (IsReadUseHardware(reader.Version)) { UseHardware = reader.ReadBoolean(); } if (IsAlignBools(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsStreamInt32(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); } if (IsReadStreamingInfo(reader.Version)) { bool isInnerData = true; if (LoadType == AudioClipLoadType.Streaming) { using (ResourcesFile res = File.Collection.FindResourcesFile(File, StreamingFileName)) { isInnerData = res == null; } } if (isInnerData) { m_audioData = reader.ReadByteArray(); reader.AlignStream(AlignType.Align4); } else { StreamingInfo.Read(reader, StreamingFileName); } } else { m_audioData = reader.ReadByteArray(); if (IsAlignAudioData(reader.Version)) { reader.AlignStream(AlignType.Align4); } } if (IsReadDecompressOnLoadThird(reader.Version)) { DecompressOnLoad = reader.ReadBoolean(); } if (IsReadStream(reader.Version)) { if (!IsStreamInt32(reader.Version)) { LoadType = reader.ReadBoolean() ? AudioClipLoadType.CompressedInMemory : AudioClipLoadType.DecompressOnLoad; } } } }
public override void Read(AssetReader reader) { base.Read(reader); if (HasLoadType(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); Channels = reader.ReadInt32(); Frequency = reader.ReadInt32(); BitsPerSample = reader.ReadInt32(); Length = reader.ReadSingle(); if (HasIsTrackerFormat(reader.Version)) { IsTrackerFormat = reader.ReadBoolean(); } if (HasAmbisonic(reader.Version)) { Ambisonic = reader.ReadBoolean(); } if (IsAlignTrackerFormat(reader.Version)) { reader.AlignStream(); } if (HasAudioClipFlags(reader.Version)) { AudioClipFlags = reader.ReadInt32(); } if (IsFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } SubsoundIndex = reader.ReadInt32(); PreloadAudioData = reader.ReadBoolean(); LoadInBackground = reader.ReadBoolean(); Legacy3D = reader.ReadBoolean(); reader.AlignStream(); if (!IsFSBResourceFirst(reader.Version)) { FSBResource.Read(reader); } if (HasType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (HasCompressionFormat(reader.Version)) { CompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } reader.AlignStream(); #if UNIVERSAL if (HasEditorResource(reader.Flags)) { EditorResource.Read(reader); if (HasCompressionFormat(reader.Version)) { EditorCompressionFormat = (AudioCompressionFormat)reader.ReadInt32(); } } #endif } else { int decompressionOrder = GetDecompressOnLoadOrder(reader.Version); if (decompressionOrder == 1) { DecompressOnLoad = reader.ReadBoolean(); } Format = (FMODSoundFormat)reader.ReadInt32(); if (HasType(reader.Version)) { Type = (FMODSoundType)reader.ReadInt32(); } if (HasLength(reader.Version)) { Length = reader.ReadSingle(); Frequency = reader.ReadInt32(); Size = reader.ReadInt32(); } if (decompressionOrder == 2) { DecompressOnLoad = reader.ReadBoolean(); } if (Has3D(reader.Version)) { Legacy3D = reader.ReadBoolean(); } if (HasUseHardware(reader.Version)) { UseHardware = reader.ReadBoolean(); } if (IsAlignBools(reader.Version)) { reader.AlignStream(); } if (IsStreamInt32(reader.Version)) { LoadType = (AudioClipLoadType)reader.ReadInt32(); } if (HasStreamingInfo(reader.Version)) { bool isInnerData = LoadType == AudioClipLoadType.Streaming ? File.Collection.FindResourceFile(StreamingFileName) == null : true; if (isInnerData) { AudioData = reader.ReadByteArray(); reader.AlignStream(); } else { StreamingInfo.Read(reader, StreamingFileName); } } else { AudioData = reader.ReadByteArray(); if (IsAlignAudioData(reader.Version)) { reader.AlignStream(); } } if (decompressionOrder == 3) { DecompressOnLoad = reader.ReadBoolean(); } if (HasStream(reader.Version)) { if (!IsStreamInt32(reader.Version)) { LoadType = reader.ReadBoolean() ? AudioClipLoadType.CompressedInMemory : AudioClipLoadType.DecompressOnLoad; } } } }
public UIBHAVEditor(BHAV target, EditorScope scope, VMEntity debugEnt) { if (debugEnt != null) { DebugMode = true; DebugEntity = debugEnt; } ContainerByID = new Dictionary <ushort, BHAVContainer>(); BHAVView = new BHAVContainer(target, scope); ContainerByID.Add(target.ChunkID, BHAVView); this.Add(BHAVView); GameThread.NextUpdate(x => { var basePrim = BHAVView.RealPrim.FirstOrDefault(); if (basePrim != null) { BHAVView.Position = GetCentralLocation(basePrim); } }); PlacingName = new UILabel(); PlacingName.Alignment = TextAlignment.Center; PlacingName.Size = new Vector2(1, 1); PlacingName.CaptionStyle = TextStyle.DefaultLabel.Clone(); PlacingName.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; PlacingName.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont; PlacingName.CaptionStyle.Size = 15; PlacingName.CaptionStyle.Color = new Color(0, 102, 26); PlacingName.Caption = "Placing Report Metric"; PlacingDesc = new UILabel(); PlacingDesc.Alignment = TextAlignment.Center; PlacingDesc.Size = new Vector2(1, 1); PlacingDesc.CaptionStyle = TextStyle.DefaultLabel.Clone(); PlacingDesc.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; PlacingDesc.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont; PlacingDesc.CaptionStyle.Size = 12; PlacingDesc.CaptionStyle.Color = new Color(0, 102, 26); PlacingDesc.Caption = "Press ESC to cancel."; this.Add(PlacingName); this.Add(PlacingDesc); if (DebugMode) { this.Add(new UITracerBar()); var resource = EditorResource.Get().Indexed; DebugFrame = debugEnt.Thread.Stack.LastOrDefault(); UpdateDebugPointer(DebugFrame); DebugGo = new UIButton(); DebugGo.Texture = resource[0]; DebugGo.Tooltip = "Go"; DebugGo.Position = new Vector2(10, 5); Add(DebugGo); DebugGo.OnButtonClick += DebugButtonClick; DebugStepIn = new UIButton(); DebugStepIn.Tooltip = "Step In"; DebugStepIn.Texture = resource[1]; DebugStepIn.Position = new Vector2(35, 5); Add(DebugStepIn); DebugStepIn.OnButtonClick += DebugButtonClick; DebugStepOver = new UIButton(); DebugStepOver.Tooltip = "Step Over"; DebugStepOver.Texture = resource[2]; DebugStepOver.Position = new Vector2(60, 5); Add(DebugStepOver); DebugStepOver.OnButtonClick += DebugButtonClick; DebugStepOut = new UIButton(); DebugStepOut.Tooltip = "Step Out"; DebugStepOut.Texture = resource[3]; DebugStepOut.Position = new Vector2(85, 5); Add(DebugStepOut); DebugStepOut.OnButtonClick += DebugButtonClick; DebugTrue = new UIButton(); DebugTrue.Tooltip = "Return True"; DebugTrue.Texture = resource[4]; DebugTrue.Position = new Vector2(LastWidth - 80, 5); Add(DebugTrue); DebugTrue.OnButtonClick += DebugButtonClick; DebugFalse = new UIButton(); DebugFalse.Tooltip = "Return False"; DebugFalse.Texture = resource[5]; DebugFalse.Position = new Vector2(LastWidth - 55, 5); Add(DebugFalse); DebugFalse.OnButtonClick += DebugButtonClick; DebugReset = new UIButton(); DebugReset.Tooltip = "Reset Object"; DebugReset.Texture = resource[6]; DebugReset.Position = new Vector2(LastWidth - 30, 5); Add(DebugReset); DebugReset.OnButtonClick += DebugButtonClick; DebugLabel = new UILabel(); DebugLabel.CaptionStyle = TextStyle.DefaultLabel.Clone(); DebugLabel.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; DebugLabel.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont; DebugLabel.CaptionStyle.Size = 12; DebugLabel.CaptionStyle.Color = Color.White; DebugLabel.Caption = "Breakpoint Hit."; DebugLabel.Position = new Vector2(115, 9); Add(DebugLabel); } }
public void DrawCutoutLines(int phase, int offset, Color color, UISpriteBatch batch) { var width = batch.GraphicsDevice.Viewport.Width; var height = batch.GraphicsDevice.Viewport.Height; var res = EditorResource.Get(); int margin = 24; int boxWidth = width - margin * 2; int boxHeight = height - margin * 2; int i = phase % 32; bool draw = ((phase / 32) % 2) == 1; i -= 32; while (i < boxWidth) { if (draw) { DrawLine(res.WhiteTex, new Vector2(Math.Max(margin, margin + i) + offset, margin + offset), new Vector2(Math.Min(width - margin, margin + i + 32) + offset, margin + offset), batch, 4, color); } i += 32; draw = !draw; } i -= boxWidth + 32; draw = !draw; while (i < boxHeight) { if (draw) { DrawLine(res.WhiteTex, new Vector2(offset + width - margin, Math.Max(margin, margin + i) + offset), new Vector2(offset + width - margin, Math.Min(height - margin, margin + i + 32) + offset), batch, 4, color); } i += 32; draw = !draw; } i -= boxHeight + 32; draw = !draw; while (i < boxWidth) { if (draw) { DrawLine(res.WhiteTex, new Vector2(width - Math.Max(margin, margin + i) + offset, (height - margin) + offset), new Vector2(width - Math.Min(width - margin, margin + i + 32) + offset, (height - margin) + offset), batch, 4, color); } i += 32; draw = !draw; } i -= boxWidth + 32; draw = !draw; while (i < boxHeight) { if (draw) { DrawLine(res.WhiteTex, new Vector2(offset + margin, height - Math.Max(margin, margin + i) + offset), new Vector2(offset + margin, height - Math.Min(height - margin, margin + i + 32) + offset), batch, 4, color); } i += 32; draw = !draw; } }
public PrimitiveBox(TREEBox box, BHAVContainer master) { TreeBox = box; Master = master; Nodes = new PrimitiveNode[0]; ApplyBoxPosition(); HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents)); Texture2D sliceTex = null; switch (Type) { case TREEBoxType.Primitive: Instruction = master.GetInstruction(box.TrueID); PreparePrimitive(); break; case TREEBoxType.True: case TREEBoxType.False: RecenterSize(32, 32); break; case TREEBoxType.Label: sliceTex = EditorResource.Get().LabelBox; Nodes = new PrimitiveNode[2]; Nodes[0] = new PrimitiveNode(); Nodes[0].Visible = false; Nodes[1] = new PrimitiveNode(); Nodes[1].Type = NodeType.Done; this.Add(Nodes[0]); this.Add(Nodes[1]); TextEdit = new UITextEdit(); TextEdit.OnChange += (elem) => { CommentChanged(); }; TextEdit.OnFocusOut += TextEdit_OnFocusOut; TextEdit.TextStyle = EditorResource.Get().TitleStyle; TextEdit.Alignment = TextAlignment.Center; TextEdit.CurrentText = TreeBox.Comment; TextEdit.NoFocusPassthrough += MouseEvents; Add(TextEdit); CommentResized(); break; case TREEBoxType.Goto: sliceTex = EditorResource.Get().GotoBox; Title = new UILabel(); Title.Alignment = TextAlignment.Middle | TextAlignment.Center; Title.Y = 0; Title.X = 0; this.Add(Title); Title.CaptionStyle = EditorResource.Get().TitleStyle; UpdateGotoLabel(); break; case TREEBoxType.Comment: sliceTex = EditorResource.Get().CommentBox; TextEdit = new UITextEdit(); TextEdit.OnChange += (elem) => { CommentChanged(); }; TextEdit.OnFocusOut += TextEdit_OnFocusOut; TextEdit.TextStyle = EditorResource.Get().CommentStyle; TextEdit.CurrentText = TreeBox.Comment; TextEdit.NoFocusPassthrough += MouseEvents; Add(TextEdit); CommentResized(); break; } if (sliceTex != null) { var sliceW = sliceTex.Width / 3; var sliceH = sliceTex.Height / 3; SliceBg = new UIImage(sliceTex).With9Slice(sliceW, sliceW, sliceH, sliceH); SliceBg.Width = Width; SliceBg.Height = Height; Add(SliceBg); } }
internal void Draw(List <h2Info> vList) { Check(); if (parents == null || parents.Count == 0 || vList == null || vList.Count == 0) { return; } if (texList == null) { c = h2Color.Get(h2ColorType.ParentLine); texList = new[] { EditorResource.GetTexture2D("corner_tr"), EditorResource.GetTexture2D("line_hz"), EditorResource.GetTexture2D("line_vt") }; } //for (var i = 0; i < vList.Count; i++) { // if (!_yMap.ContainsKey(vList[i].instID)) { // _yMap.Add(vList[i].instID, vList[i].drawRect.y); // } else { // _yMap[vList[i].instID] = vList[i].drawRect.y; // } //} if (iList == null) { iList = new List <int>(); } else { iList.Clear(); } var l = parents.Count; var fn = -1; var max = -1; //Debug.Log("---------------------------------------------------- " + Event.current.type + ":" + vList.Count); for (var i = 0; i < vList.Count; i++) { var info = vList[i]; if (info == null || info.go == null) { continue; } var count = info.Transform.parentCount; if (count > l) { continue; } //Debug.Log(i + ":" + info.go); if (count <= max) { //back out ! //Debug.Log("Back out ... " + i + ":" + max + ":" + count); fn = max; break; } if (count == l) { if (info.go == selected) { selectedY = info.drawRect.y; fn = i; break; } continue; } if (info.go == parents[count]) { max = count; iList.Add(i); if (h2Settings.DrawParentHighlight) { Highlight(info.drawRect); } } } if (fn == -1 && iList.Count == 0) { //check for crossing var cgo = vList[0].go; if (cgo != null) { var pList = cgo.xGetParents(true); var pLevel = -1; var min = Mathf.Min(pList == null ? 0 : pList.Count, parents.Count) - 1; for (var i = min; i >= 0; i--) { if (pList[i] == parents[i]) { pLevel = i; break; } } if (pLevel != -1) // crossing { if (selectedY == 0f || selectedY > vList[0].drawRect.y) { using (GuiX.GUIColor(c)) { DrawLine(0, vList.Count - 1, vList, pLevel + 1, false, false); } } } } //Debug.Log("Crossing ... " + pLevel + ":" + selectedY + ":" + vList[0].drawRect.y); } else { var st = iList.Count > 0 ? iList[0] : fn; var ed = iList.Count > 0 ? iList[iList.Count - 1] : fn; var stLv = vList[st].Transform.parentCount; var edLv = vList[ed].Transform.parentCount; //Debug.Log(st + ":" + ed + ":" + fn); using (GuiX.GUIColor(c)) { if (stLv > 0) { // draw from top //Debug.Log("Top ----> " + stLv + ":" + Event.current); DrawLine(0, st, vList, stLv, true, false); } if (fn == -1) { // draw till end //Debug.Log("End ----> " + edLv); DrawLine(ed, vList.Count - 1, vList, edLv + 1, false, true); } else if (fn != max) { iList.Add(fn); } if (iList.Count > 1) { for (var i = 0; i < iList.Count - 1; i++) { //Debug.Log("MID ----> " + vList[iList[i + 1]].go + ":" + iList[i+1]); DrawLine(iList[i], iList[i + 1], vList, vList[iList[i + 1]].Transform.parentCount, true, true); } } } } }
public void AddResource(EditorResource resource) { resources.Add(resource); }