public static void ParticleActive(TimeLinePlayer linePlayer, LayoutBase layoutBase) { var layout = layoutBase as ParticleLayout; var per = linePlayer.Releaser.Controllor.Perception as BattlePerception; var particle = per.CreateParticlePlayer(linePlayer.Releaser, layout); if (particle == null) { return; } switch (layout.destoryType) { case ParticleDestoryType.LayoutTimeOut: linePlayer.AttachParticle(particle); break; case ParticleDestoryType.Time: particle.AutoDestory(layout.destoryTime); break; case ParticleDestoryType.Normal: //自动销亡 break; } }
/// <summary> /// Initializes an instance of the LayoutBase class based on supplied input /// </summary> /// <param name="name">Specifies the name of the toolbar</param> /// <returns>The requested instance of the Layout base class</returns> private LayoutBase InitializeLayout(string name, string scope) { LayoutBase layout = null; LayoutManager flyweight = LayoutManager.Instance; if ("SIMPLE_TREE_LAYOUT".Equals(name)) { layout = flyweight.GetLayoutByName(InternalLayouts.SimpleTree); } else if (name.StartsWith("TREE_")) { layout = flyweight.GetLayoutByName(InternalLayouts.OriginalTree); } else if (name.StartsWith("CIRCLE_") || name.StartsWith("RADIAL_")) { layout = flyweight.GetLayoutByName(InternalLayouts.Circle); } else if (name.StartsWith("NETWORK_")) { layout = flyweight.GetLayoutByName(InternalLayouts.Network); } else if (name.StartsWith("GRID_")) { layout = flyweight.GetLayoutByName(InternalLayouts.Grid); } else { throw new InvalidOperationException("Unknown or invalid layout specified"); } return(layout); }
public DefaultLayoutConfigure(string filePath) { _filePath = filePath; _defaultLayoutInfo = ConfigFileHelper.LoadConfigObject <DefaultLayoutInfo>(_filePath); _layout = LayoutFactory.Instance.CreateLayout(_defaultLayoutInfo.LayoutCell.Columns, _defaultLayoutInfo.LayoutCell.Rows); }
public VisioLayoutOptions() { var flowchart = new FlowchartLayout(); flowchart.LayoutDirection = PageLayouts.LayoutDirection.TopToBottom; this.Layout = flowchart; }
public override IStateBase ProcessCardReadAction(CardReadAction card, ref bool forceCallStateMethod) { _client = _app.databaseLayer.GetClient(card.CardNumber); //app.db.Cards.Where(c => c.CardNumber == card.CardNumber).FirstOrDefault()?.Client; _layout = _app.MessageLayout; if (_client == null) { _clientMsg = "Neznáma karta"; } else { if (_selected == null) { _clientMsg = "Nevybrali ste jedlo"; } else { Menu menu = _menuOnScreen[_selected.GetValueOrDefault()]; bool success; (success, _clientMsg) = _app.databaseLayer.CreateOrder(_client, menu); } } forceCallStateMethod = true; return(this); }
public Page(List <ImageCell> cells, int pageNo, int pageCount, LayoutBase layout) { Cells = cells; No = pageNo; PageCount = pageCount; Layout = Layout.CreateLayout(layout.Columns, layout.Rows); }
public static void LookAtTargetActive(TimeLinePlayer linePlayer, LayoutBase layoutBase) { var per = linePlayer.Releaser.Controllor.Perception as BattlePerception; per.LookAtCharacter(linePlayer.Releaser.ReleaserTarget.Releaser, linePlayer.Releaser.ReleaserTarget.ReleaserTarget); }
/// <summary> /// Redraws the graph with the specified layout type /// </summary> /// <param name="layout">Type of graph layout</param> /// <param name="isAnimated">Specifies whether or not to animate the graph when it's laid out</param> /// <param name="scope">Specifies the default graph scope</param> /// <param name="rootNode">Specifies the root node for layouts that require one</param> public void LayoutGraph(LayoutBase layout, bool isAnimated, string scope, NodeViewModelBase rootNode) { LayoutManager flyweight = LayoutManager.Instance; // Make sure we have a scope if (String.IsNullOrWhiteSpace(scope)) { scope = this.defaultComponentInstanceScope; } // Get the graph as a GraphMapData object GraphMapData graphMapData = GetGraphComponents(scope).ExportGraph(); // Execute the layout DispatcherHelper.UIDispatcher.BeginInvoke(() => { if (rootNode != null) { layout.CalculateLayout(graphMapData, rootNode.ParentNode); } else { layout.CalculateLayout(graphMapData); } System.Diagnostics.Debug.WriteLine(""); foreach (Delegate d in ContextMenuManager.Instance.GetContextMenuOpeningInvocationList()) { System.Diagnostics.Debug.WriteLine((d.Target as GraphComponents).Scope); } layout.PositionNodes(isAnimated, graphMapData); }); }
public void WriteBackToDefaultLayout(int row, int column) { _layout = LayoutFactory.Instance.CreateLayout(column, row); _defaultLayoutInfo.LayoutCell.Rows = row; _defaultLayoutInfo.LayoutCell.Columns = column; _defaultLayoutInfo.MaxImageCount = row * column; ConfigFileHelper.SaveConfigObject(_defaultLayoutInfo, _filePath); }
private void SetInitValues() { _pageNum = 0; _selected = null; SetDateToOrder(DateTime.Now.Date); _layout = _app.OrdersLayout; _clientMsg = null; }
public static void MissileActive(TimeLinePlayer linePlayer, LayoutBase layoutBase) { var layout = layoutBase as MissileLayout; var per = linePlayer.Releaser.Controllor.Perception as BattlePerception; var missile = per.CreateMissile(layout, linePlayer.Releaser); linePlayer.Releaser.AttachElement(missile); }
/// <summary> /// Event handler for the LiveDataLoaded event /// </summary> /// <param name="args">Any event arguments that might be passed</param> public void LiveDataLoadedEventHandler(DataLoadedEventArgs args) { lock (syncObj) { LayoutBase activeLayout = LayoutManager.Instance.ActiveLayout; // Refresh the graph layout DispatcherHelper.UIDispatcher.BeginInvoke(() => GraphManager.Instance.LayoutGraph(activeLayout, false)); } }
public GridContent(LayoutBase container, Index2D idx, GridSize widthDefinition, GridSize heightDefinition) : this(idx, widthDefinition, heightDefinition) { Container = container; MinSize = ComputeMinSize(); }
private void CreateLayout(object userState) { var type = userState as Type; var layout = LayoutBase.CreateInstance(type); line.Layouts.Add(layout); line.Points.Add(new TimePoint() { Time = currentzTime, GUID = layout.GUID }); }
public static void CallUnitActive(TimeLinePlayer linePlayer, LayoutBase layoutBase) { var unitLayout = layoutBase as CallUnitLayout; var releaser = linePlayer.Releaser; var charachter = releaser.ReleaserTarget.Releaser; var per = releaser.Controllor.Perception as BattlePerception; int level = unitLayout.level; switch (unitLayout.valueFrom) { case Proto.GetValueFrom.CurrentConfig: break; case Proto.GetValueFrom.MagicLevelParam1: { var param1 = releaser[0]; if (string.IsNullOrEmpty(param1)) { return; } level = Convert.ToInt32(param1); } break; } //判断是否达到上限 if (unitLayout.maxNum <= releaser.UnitCount) { return; } var data = ExcelToJSONConfigManager .Current.GetConfigByID <CharacterData>(unitLayout.characterID); var magics = ExcelToJSONConfigManager .Current.GetConfigs <CharacterMagicData>(t => t.CharacterID == unitLayout.characterID); var unit = per.CreateCharacter( level, data, magics.ToList(), charachter.TeamIndex, charachter.View.Transform.position, charachter.View.Transform.forward, -1 ); //无限视野 unit[Proto.HeroPropertyType.ViewDistance].SetAppendValue(100000); releaser.AttachElement(unit, unitLayout.time); releaser.OnEvent(Layout.EventType.EVENT_UNIT_CREATE); per.ChangeCharacterAI(data.AIResourcePath, unit); }
public static void EnableLayout(LayoutBase layout, TimeLinePlayer player) { MethodInfo m; if (_handler.TryGetValue(layout.GetType(), out m)) { m.Invoke(null, new object[] { player, layout }); } else { throw new Exception("No Found handle Type :" + layout.GetType()); } }
public override IStateBase ProcessCardReadAction(CardReadAction card, ref bool forceCallStateMethod) { _client = _app.databaseLayer.GetOrders(card.CardNumber); if (_client == null) { _clientMsg = "Neznáma karta"; } else { _layout = _app.CardScannedLayout; _client.Orders = _client.Orders.Where(o => o.Served == null && o.ForDate.Date >= DateTime.Now.Date).ToList(); } forceCallStateMethod = true; return(this); }
public void LayoutGraph(string layoutName, bool isAnimated, string scope, INode rootNode) { GraphManager manager = GraphManager.Instance; LayoutBase layout = LayoutManager.Instance.GetLayoutByName(layoutName); NodeViewModelBase nodeShape; // TODO: Consider support for INodeShape if (rootNode != null) { nodeShape = GraphManager.Instance.DefaultGraphComponentsInstance.GetNodeViewModel(rootNode) as NodeViewModelBase; } else { nodeShape = null; } manager.LayoutGraph(layout, isAnimated, scope, nodeShape); }
private void SetActiveLayout(CalendarMode mode) { switch (mode) { case CalendarMode.EditBox: activeLayout = editBoxLayout; break; case CalendarMode.SelectBox: break; case CalendarMode.Label: break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// /// </summary> /// <param name="layoutName"></param> private void LayoutGraph(string layoutName) { // Get a light weight version of the graph data to be // used with the layout GraphMapData graphMapData = GraphComponentsUtility.GetGraph(GraphManager.Instance.GetGraphComponents(scope)); // Get the instance of the LinLog layout LayoutBase graphLayout = LayoutManager.Instance.GetLayoutByName(layoutName); // Wire up the LayoutFinished event graphLayout.LayoutFinished += new EventHandler(LayoutFinishedHandler); // Execute the layout on the UI thread DispatcherHelper.UIDispatcher.BeginInvoke(() => { graphLayout.CalculateLayout(graphMapData); graphLayout.PositionNodes(false, graphMapData); }); }
public static void MotionActive(TimeLinePlayer linePlayer, LayoutBase layoutBase) { var layout = layoutBase as MotionLayout; var releaser = linePlayer.Releaser; var per = linePlayer.Releaser.Controllor.Perception as BattlePerception; if (layout.targetType == Layout.TargetType.Releaser) { per.PlayMotion(releaser.ReleaserTarget.Releaser, layout.motionName); } else if (layout.targetType == Layout.TargetType.Target) { if (releaser.ReleaserTarget.ReleaserTarget == null) { return; } per.PlayMotion(releaser.ReleaserTarget.ReleaserTarget, layout.motionName); } }
/// <summary> /// Adds the component to a form<br/> /// Registers th efield using the supplied ID /// </summary> /// <param name="id"></param> /// <param name="label"></param> /// <param name="control"></param> /// <param name="itemLayout"></param> /// <exception cref="Exception"></exception> public void AddField(string id, string label, Component control, LayoutBase itemLayout = null) { if (_dictFields.ContainsKey(id)) { throw new Exception("Duplicated form element ID: " + id); } _dictFields.Add(id, control); Group itemGroup = new Group { PercentWidth = 100, Layout = itemLayout ?? new VerticalLayout() // TODO: different item layouts }; /*_fieldGroup.*/ AddChild(itemGroup); if (_dictItems.ContainsKey(id)) { throw new Exception("Duplicated form element ID: " + id); } _dictItems.Add(id, itemGroup); // 1) label Label lbl = new Label { Text = label, Width = LabelWidth }; lbl.SetStyle("labelStyle", GetStyle("itemLabelStyle")); itemGroup.AddChild(lbl); // 2) control if (null != control) { itemGroup.AddChild(control); } else { lbl.PercentWidth = 100; } }
/// <summary> /// Handles the ToolbarItemClicked event /// </summary> /// <param name="args">The arguments for the event</param> public void ToolbarItemClickedEventHandler(ToolBarItemEventArgs args) { NodeViewModelBase rootNode = GetGraphComponents(args.Scope).NodeSelector.SelectedNode; // TODO: USE CONSTANT FOR ITEM NAME // TODO: Controls should control their own behavior if (args.ToolBarItem.Name == "GENERATOR") { CreateRandomGraph(args.Scope); } else if (args.ToolBarItem.Name.EndsWith("_LAYOUT")) { LayoutBase layout = InitializeLayout(args.ToolBarItem.Name, args.Scope); // Perform the layout LayoutGraph(layout, false, args.Scope, rootNode); } else if (args.ToolBarItem.Name == "IMPORT") { PerformImport(args.Scope, new GraphMLGraphDataFormat()); // TODO: Determine which type at runtime } else if (args.ToolBarItem.Name == "EXPORT") { PerformExport(args.Scope); } else if (args.ToolBarItem.Name == "GRAPH_TO_IMAGE") { SaveGraphAsImage(); } else if (args.ToolBarItem.Name == "PRINT_GRAPH") { PrintGraph(); } else if (args.ToolBarItem.Name == "RESIZE") { UI.GraphViewModel graphVM = UI.ViewModelLocator.GraphDataStatic; graphVM.ResizeToFit(); //TODO: THIS SHOULD BE DECOUPLED } }
public LayoutImport(string FilePath, bool ImportOnlyFirstLine, LayoutType LayoutType) : base(LayoutType) { _layoutBase = (LayoutBase)Layout; _layoutBase.ImportOnlyFirstLine = ImportOnlyFirstLine; _breakPoint = BreakPoint.Success; Layout.Import(FilePath); if (_layoutBase.HasError) { _breakPoint = BreakPoint.Import; return; } //TODO: FEEL FREE TO CHANGE THE STRUCTURE AND THE METHOD SIGNATURE if (!ImportOnlyFirstLine) { Layout.ValidateStructure(); if (_layoutBase.HasError) { _breakPoint = BreakPoint.ValidateStructure; return; } Layout.Validate(); if (_layoutBase.HasError) { _breakPoint = BreakPoint.Validate; return; } Layout.Save(); if (_layoutBase.HasError) { _breakPoint = BreakPoint.Save; return; } } }
public override IStateBase ProcessTimerElapsed() { List <IAction> action; switch (_layout) { case ScanCardLayout scanCard: action = new List <IAction> { new ShowLayoutAction(scanCard.Name, SetDateTimeToNow() .Concat (scanCard.SetTexts("Informácie o objednávkach", _clientMsg ?? "Priložte kartu")) .ToArray()) }; break; case CardScannedLayout cardScanned: action = new List <IAction> { new ShowLayoutAction(cardScanned.Name, SetDateTimeToNow() .Concat (cardScanned.SetMeals(_client)) .ToArray()), }; break; default: action = new List <IAction>(); break; } _app.Rallo.SendMessage(new Message(action.ToArray())); _layout = _app.ScanCardLayout; _clientMsg = null; return(this); }
private LayoutBase(LayoutBase.__Internal native, bool skipVTables = false) : this(__CopyValue(native), skipVTables) { __ownsNativeInstance = true; NativeToManagedMap[__Instance] = this; }
private static void* __CopyValue(LayoutBase.__Internal native) { var ret = Marshal.AllocHGlobal(8); global::CppSharp.Parser.AST.LayoutBase.__Internal.cctor_1(ret, new global::System.IntPtr(&native)); return ret.ToPointer(); }
public static LayoutBase __CreateInstance(LayoutBase.__Internal native, bool skipVTables = false) { return new LayoutBase(native, skipVTables); }
/// <summary> /// Process data in an input file that contains a layout. /// </summary> /// <param name="filename"></param> bool ProcessData(string filename, byte[] inData) { EndianBinaryReader reader = null; // now we need to decide what they just opened if (inData == null && filename != "") { reader = new EndianBinaryReader(File.Open(filename, FileMode.Open), Encoding.GetEncoding(932)); } else { reader = new EndianBinaryReader(inData); } string magic = ""; // we have a Yaz0 compressed file if (reader.ReadStringFrom(0, 4) == "Yaz0") { // we have to close our reader so we can properly read this file as a Yaz0 stream reader.Close(); MemoryStream ms = null; if (inData == null) { ms = new Yaz0(File.Open(filename, FileMode.Open)); } else { ms = new Yaz0(new MemoryStream(inData)); } reader = new EndianBinaryReader(ms); magic = reader.ReadStringFrom(0, 4); } // we have a LZ compressed file else if (reader.ReadByteFrom(0) == 0x11) { LZ77 lzFile = new LZ77(ref reader); byte[] lzData = lzFile.getData(); // close our current reader to open a new one with our input data reader.Close(); reader = new EndianBinaryReader(lzData); magic = reader.ReadStringFrom(0, 4); } // no compression else { // it is not yaz0 compressed, so we see the magic magic = reader.ReadStringFrom(0, 4); } // now we have to check our magic to see what kind of file it is switch (magic) { case "darc": mArchive = new DARC(ref reader); break; case "NARC": mArchive = new NARC(ref reader); break; case "SARC": mArchive = new SARC(ref reader); break; case "RARC": reader.SetEndianess(Endianess.Big); mArchive = new RARC(ref reader); break; case "U?8-": reader.SetEndianess(Endianess.Big); mArchive = new U8(ref reader); break; default: MessageBox.Show("Error. Unsupported format with magic: " + magic); break; } string layoutType = ""; // some files have their string table nullified, which makes the names obfuscated // I've only seen this in SARCs from MK7, but there's probably more if (mArchive != null) { if (mArchive.isStringTableObfuscated()) { MessageBox.Show("This file has obfuscated file names. The editor attempted to find layout files, but cannot supply names."); } } reader.Close(); if (mArchive == null) { MessageBox.Show("Format not supported."); return(false); } // the only familiar format with archives in archives is SARC and RARC if (mArchive.getType() == ArchiveType.SARC || mArchive.getType() == ArchiveType.RARC) { List <string> names = mArchive.getArchiveFileNames(); if (names.Count != 0) { DialogResult res = MessageBox.Show("This archive has another archive inside of it.\nDo you wish to choose one of the found archives to select a layout?", "Internal Archive", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { LayoutChooser archiveChooser = new LayoutChooser(); archiveChooser.insertEntries(names); archiveChooser.ShowDialog(); // if this worked, we dont need to do anything bool result = ProcessData(archiveChooser.getSelectedFile(), mArchive.getDataByName(archiveChooser.getSelectedFile())); if (result) { return(true); } else { MessageBox.Show("Failed to get the internal file."); return(false); } } } } // get all of our needed files mLayoutFiles = mArchive.getLayoutFiles(); mLayoutAnimFiles = mArchive.getLayoutAnimations(); mLayoutImages = mArchive.getLayoutImages(); mLayoutControls = mArchive.getLayoutControls(); if (mLayoutFiles.Count == 0) { MessageBox.Show("This file contains no layouts."); return(false); } LayoutChooser layoutChooser = new LayoutChooser(); layoutChooser.insertEntries(new List <string>(mLayoutFiles.Keys)); layoutChooser.ShowDialog(); string selectedFile = layoutChooser.getSelectedFile(); if (selectedFile == null) { return(false); } string[] sections = selectedFile.Split('/'); mMainRoot = ""; // remove "lyt" part and the file name // this will be our main root of the entire opened file for (int i = 0; i < sections.Length - 2; i++) { mMainRoot += sections[i] + "/"; } if (layoutType == "") { layoutType = Path.GetExtension(selectedFile); } // now we have to init a layout reader EndianBinaryReader layoutReader = null; byte[] data; switch (layoutType) { case ".brlyt": data = mLayoutFiles[selectedFile]; layoutReader = new EndianBinaryReader(data); mMainLayout = new BRLYT(ref layoutReader); layoutReader.Close(); break; case ".bclyt": data = mLayoutFiles[selectedFile]; layoutReader = new EndianBinaryReader(data); mMainLayout = new BCLYT(ref layoutReader); break; case ".bflyt": data = mLayoutFiles[selectedFile]; layoutReader = new EndianBinaryReader(data); mMainLayout = new BFLYT(ref layoutReader); break; case ".blo": data = mLayoutFiles[selectedFile]; layoutReader = new EndianBinaryReader(data); if (layoutReader.ReadStringFrom(4, 4) == "blo1") { mMainLayout = new BLO1(ref layoutReader); } else { mMainLayout = new BLO2(ref layoutReader); } break; default: MessageBox.Show("This format is not supported yet."); break; } layoutReader.Close(); if (mMainLayout == null) { return(false); } // set our propertygrid with our LYT object mainPropertyGrid.SelectedObject = mMainLayout.getLayoutParams(); if (mMainLayout.getRootPanel() == null) { MessageBox.Show("Error, the root pane in this layout is not specified."); return(false); } LayoutBase pane = null; LayoutBase group = null; // now we have to grab our root panel, which is different on each console // so we have to specifically get the one we want // the same applies to our root group pane = mMainLayout.getRootPanel(); // this should be RootPane TreeNode n1 = new TreeNode { Tag = pane, Name = pane.mName, Text = pane.mName, }; panelList.Nodes.Add(n1); fillNodes(pane.getChildren()); // now for our groups group = mMainLayout.getRootGroup(); if (group != null) { TreeNode n1_1 = new TreeNode { Tag = group, Name = group.mName, Text = group.mName, }; panelList.Nodes.Add(n1_1); fillNodes(group.getChildren()); } // now for textures and fonts // but it is possible for either one to not exist if (mMainLayout.containsTextures()) { foreach (string str in mMainLayout.getTextureNames()) { texturesList.Items.Add(str); } } if (mMainLayout.containsFonts()) { foreach (string str in mMainLayout.getFontNames()) { fontsList.Items.Add(str); } } // and our materials if (mMainLayout.containsMaterials()) { foreach (string str in mMainLayout.getMaterialNames()) { materialList.Items.Add(str); } } // this draws the border of the layout mMainLayout.draw(); layoutViewer.Refresh(); return(true); }
public CellLink(LayoutBase layout) { _layout = layout; AddRange(CellFactory.Instance.CreateCells(_layout.Capacity)); }
public BCLYT(ref EndianBinaryReader reader) { reader.SetEndianess(Endianess.Little); if (reader.ReadString(4) != "CLYT") { Console.WriteLine("Bad magic. Expected CLYT."); return; } mBOM = reader.ReadUInt16(); mHeaderLength = reader.ReadUInt16(); mRevision = reader.ReadUInt32(); mFileSize = reader.ReadUInt32(); mSectionCount = reader.ReadUInt32(); mLayoutParams = new LYT1(ref reader); mUserDataEntries = new List <USD1>(); LayoutBase prev = null; LayoutBase parent = null; // for groups LayoutBase previousGroup = null; LayoutBase groupParent = null; bool isRootPaneSet = false; bool isRootGroupSet = false; string magic = ""; for (uint i = 0; i < mSectionCount; i++) { magic = reader.ReadString(4); switch (magic) { case "txl1": mTextureList = new TXL1(ref reader); break; case "fnl1": mFontList = new FNL1(ref reader); break; case "mat1": mMaterialList = new MAT1(ref reader); break; case "pan1": PAN1 panel = new PAN1(ref reader); if (!isRootPaneSet) { mRootPanel = panel; isRootPaneSet = true; } if (parent != null) { parent.addChild(panel); panel.setParent(parent); } prev = panel; break; case "pic1": PIC1 pic = new PIC1(ref reader); if (parent != null) { parent.addChild(pic); pic.setParent(parent); } prev = pic; break; case "bnd1": BND1 bnd = new BND1(ref reader); if (parent != null) { parent.addChild(bnd); bnd.setParent(parent); } prev = bnd; break; case "txt1": TXT1 txt = new TXT1(ref reader); if (parent != null) { parent.addChild(txt); txt.setParent(parent); } prev = txt; break; case "usd1": USD1 usd = new USD1(ref reader); if (prev != null) { prev.addUserData(usd); } break; case "wnd1": WND1 window = new WND1(ref reader, ref mMaterialList); if (parent != null) { parent.addChild(window); window.setParent(parent); } prev = window; break; case "pas1": if (prev != null) { parent = prev; } reader.ReadUInt32(); break; case "pae1": prev = parent; parent = prev.getParent(); reader.ReadUInt32(); break; case "pts1": MessageBox.Show("PTS1 found! Do tell shibboleet about this..."); break; case "grp1": GRP1 group = new GRP1(ref reader); if (!isRootGroupSet) { mRootGroup = group; isRootGroupSet = true; } if (groupParent != null) { groupParent.addChild(group); group.setParent(groupParent); } previousGroup = group; break; case "grs1": if (previousGroup != null) { groupParent = previousGroup; } reader.ReadUInt32(); break; case "gre1": previousGroup = groupParent; groupParent = previousGroup.getParent(); reader.ReadUInt32(); break; default: Console.WriteLine("Unsupported magic " + magic); break; } } }
private void SetLayout(LayoutBase layout) { ViewControl.LayoutManager.SetLayout(layout.Rows, layout.Columns); }
public BFLYT(ref EndianBinaryReader reader) : base() { if (reader.ReadString(4) != "FLYT") { Console.WriteLine("Bad magic. Expected FLYT."); return; } mBOM = reader.ReadUInt16(); if (mBOM == 0xFEFF) { reader.SetEndianess(utils.Endian.Endianess.Little); } else { reader.SetEndianess(utils.Endian.Endianess.Big); } mHeaderSize = reader.ReadUInt16(); mVersion = reader.ReadUInt32(); mVersionMajor = mVersion >> 24; mVersionMinor = (mVersion >> 16) & 0xFF; mVersionMicro = (mVersion >> 8) & 0xFF; mVersionMicro2 = mVersion & 0xFF; string str = String.Format("Version: {0}.{1}.{2}.{3}", mVersionMajor, mVersionMinor, mVersionMicro, mVersionMicro2); Console.WriteLine(str); mFileSize = reader.ReadUInt32(); mNumSections = reader.ReadUInt16(); reader.ReadUInt16(); mLayoutParams = new LYT1(ref reader); // for panels LayoutBase prev = null; LayoutBase parent = null; bool isRootPaneSet = false; bool isRootGroupSet = false; // for groups LayoutBase previousGroup = null; LayoutBase groupParent = null; string magic = ""; for (ushort i = 0; i < mNumSections - 1; i++) { magic = reader.ReadString(4); switch (magic) { case "txl1": mTextureList = new TXL1(ref reader); break; case "fnl1": mFontList = new FNL1(ref reader); break; case "mat1": mMaterialList = new MAT1(ref reader, mVersion); break; case "pan1": PAN1 panel = new PAN1(ref reader); if (!isRootPaneSet) { mRootPanel = panel; isRootPaneSet = true; } if (parent != null) { parent.addChild(panel); panel.setParent(parent); } prev = panel; break; case "pic1": PIC1 pic = new PIC1(ref reader, ref mMaterialList, mVersionMajor, mVersionMinor); if (parent != null) { parent.addChild(pic); pic.setParent(parent); } prev = pic; break; case "txt1": TXT1 txt = new TXT1(ref reader, ref mMaterialList, ref mFontList, mVersion); if (parent != null) { parent.addChild(txt); txt.setParent(parent); } prev = txt; break; case "bnd1": BND1 bnd = new BND1(ref reader); if (parent != null) { parent.addChild(bnd); bnd.setParent(parent); } prev = bnd; break; case "prt1": PRT1 prt = new PRT1(ref reader); if (parent != null) { parent.addChild(prt); prt.setParent(parent); } prev = prt; break; case "wnd1": WND1 window = new WND1(ref reader, ref mMaterialList); if (parent != null) { parent.addChild(window); window.setParent(parent); } prev = window; break; case "cnt1": CNT1 cnt = new CNT1(ref reader, mVersionMajor); if (parent != null) { parent.addChild(cnt); cnt.setParent(parent); } prev = cnt; break; case "usd1": USD1 usd = new USD1(ref reader); if (prev != null) { prev.addUserData(usd); } break; case "pas1": if (prev != null) { parent = prev; } reader.ReadUInt32(); break; case "pae1": prev = parent; parent = prev.getParent(); reader.ReadUInt32(); break; case "grp1": GRP1 group = new GRP1(ref reader, mVersionMajor); if (!isRootGroupSet) { mRootGroup = group; isRootGroupSet = true; } if (groupParent != null) { groupParent.addChild(group); group.setParent(groupParent); } previousGroup = group; break; case "grs1": if (previousGroup != null) { groupParent = previousGroup; } reader.ReadUInt32(); break; case "gre1": previousGroup = groupParent; groupParent = previousGroup.getParent(); reader.ReadUInt32(); break; default: Console.WriteLine("Unsupported magic " + magic); break; } } }