public static BackgroundInfo GetBgInfo(GMFileContent content, uint id) { if (id >= content.Backgrounds->Count) { throw new ArgumentOutOfRangeException(nameof(id)); } var ret = new BackgroundInfo(); var be = (BgEntry *)GMFile.PtrFromOffset(content, (&content.Backgrounds->Offsets)[id]); ret.Name = StringFromOffset(content, be->Name); ret.TexPageIndex = be->TextureOffset; for (uint i = 0; i < content.TexturePages->Count; i++) { if (be->TextureOffset == (&content.TexturePages->Offsets)[i]) { ret.TexPageIndex = i; break; } } return(ret); }
private void bgSetListBox_SelectedIndexChanged(object sender, EventArgs e) { if (bgSetListBox.SelectedItem == null) { return; } bgImageContainer.Controls.Clear(); WzImageProperty parentProp = Program.InfoManager.BackgroundSets[(string)bgSetListBox.SelectedItem][aniBg.Checked ? "ani" : "back"]; if (parentProp == null || parentProp.WzProperties == null) { return; } foreach (WzImageProperty prop in parentProp.WzProperties) { BackgroundInfo bgInfo = BackgroundInfo.Get((string)bgSetListBox.SelectedItem, aniBg.Checked, prop.Name); if (bgInfo == null) { continue; } ImageViewer item = bgImageContainer.Add(bgInfo.Image, prop.Name, true); item.Tag = bgInfo; item.MouseDown += new MouseEventHandler(bgItem_Click); item.MouseUp += new MouseEventHandler(ImageViewer.item_MouseUp); item.MaxHeight = UserSettings.ImageViewerHeight; item.MaxWidth = UserSettings.ImageViewerWidth; } }
public BackgroundInfo GetCurrentPositionData(int?id, Boolean isCurrentPosition) { CurrentPositionBusinessLayer cpbl = new CurrentPositionBusinessLayer(); BackgroundInfo currentPosition = cpbl.GetCurrentPositionByID(id, isCurrentPosition); return(currentPosition); }
public static DatatxtDesc ParseDatatxt(string st) { DatatxtDesc result = new DatatxtDesc(); StringReader sr = new StringReader(st); string line; while ((line = sr.ReadLine()) != null) { if (line.Trim().Length == 0) continue; if (line.Trim() == "<object>") while ((line = sr.ReadLine()) != null) { if (line.Trim() == "<object_end>") break; ObjectInfo of = new ObjectInfo(GetTagAndIntValue(line, "id:"), GetTagAndIntValue(line, "type:"), GetTagAndStrValue(line, "file:")); result.lObject.Add(of); } if (line.Trim() == "<background>") while ((line = sr.ReadLine()) != null) { if (line.Trim() == "<background_end>") break; BackgroundInfo bf = new BackgroundInfo(GetTagAndIntValue(line, "id:"), GetTagAndStrValue(line, "file:")); result.lBackground.Add(bf); } } sr.Close(); return result; }
public void LoadBackgrounds(WzImage mapImage, Board mapBoard) { WzSubProperty bgParent = (WzSubProperty)mapImage["back"]; WzSubProperty bgProp; int i = 0; while ((bgProp = (WzSubProperty)bgParent[(i++).ToString()]) != null) { int x = InfoTool.GetInt(bgProp["x"]); int y = InfoTool.GetInt(bgProp["y"]); int rx = InfoTool.GetInt(bgProp["rx"]); int ry = InfoTool.GetInt(bgProp["ry"]); int cx = InfoTool.GetInt(bgProp["cx"]); int cy = InfoTool.GetInt(bgProp["cy"]); int a = InfoTool.GetInt(bgProp["a"]); BackgroundType type = (BackgroundType)InfoTool.GetInt(bgProp["type"]); bool front = InfoTool.GetBool(bgProp["front"]); bool? flip_t = InfoTool.GetOptionalBool(bgProp["f"]); bool flip = flip_t.HasValue ? flip_t.Value : false; string bS = InfoTool.GetString(bgProp["bS"]); bool ani = InfoTool.GetBool(bgProp["ani"]); string no = InfoTool.GetInt(bgProp["no"]).ToString(); BackgroundInfo bgInfo = BackgroundInfo.Get(bS, ani, no); if (bgInfo == null) { continue; } IList list = front ? mapBoard.BoardItems.FrontBackgrounds : mapBoard.BoardItems.BackBackgrounds; list.Add((BackgroundInstance)bgInfo.CreateInstance(mapBoard, x, y, i, rx, ry, cx, cy, type, a, front, flip)); } }
/// <summary> /// On click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bgItem_Click(object sender, MouseEventArgs e) { ImageViewer imageViewer = sender as ImageViewer; BackgroundInfo bgInfo = (BackgroundInfo)((ImageViewer)sender).Tag; if (e.Button == MouseButtons.Left) { lock (hcsm.MultiBoard) { hcsm.EnterEditMode(ItemTypes.Backgrounds); hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(bgInfo); hcsm.MultiBoard.Focus(); ((ImageViewer)sender).IsActive = true; } } else // right click { if (bgInfo.Type == BackgroundInfoType.Spine) // only shows an animation preview window if its a spine object. { ContextMenu cm = new ContextMenu(); MenuItem menuItem = new MenuItem(); menuItem.Text = "Preview"; menuItem.Tag = bgInfo; menuItem.Click += new EventHandler(delegate(object sender_, EventArgs e_) { MenuItem menuItem_ = sender_ as MenuItem; BackgroundInfo bgInfo_ = menuItem_.Tag as BackgroundInfo; WzImageProperty spineAtlasProp = bgInfo_.WzImageProperty.WzProperties.FirstOrDefault( wzprop => wzprop is WzStringProperty && ((WzStringProperty)wzprop).IsSpineAtlasResources); if (spineAtlasProp != null) { WzStringProperty stringObj = (WzStringProperty)spineAtlasProp; Thread thread = new Thread(() => { try { WzSpineAnimationItem item = new WzSpineAnimationItem(stringObj); // Create xna window SpineAnimationWindow Window = new SpineAnimationWindow(item); Window.Run(); } catch (Exception ex) { } }); thread.Start(); thread.Join(); } }); cm.MenuItems.Add(menuItem); cm.Show(imageViewer, new Point(0, 50)); } } }
private static void WriteBackground(BBData data, BackgroundInfo bi, StringsChunkBuilder strings, int[] texPagOffsets) { data.Buffer.Write(new BgEntry { Name = strings.GetOffset(bi.Name), TextureOffset = bi.TexPageIndex.HasValue ? (uint)texPagOffsets[bi.TexPageIndex.Value] : 0 }); }
public static JsonData SerializeBg(BackgroundInfo bgnd) { var r = CreateObj(); r["texture"] = bgnd.TexPageIndex; return(r); }
/// <summary> /// Inser BackgroundInfo /// </summary> /// <param name="entity"></param> /// <returns></returns> public Task <bool> Create(BackgroundInfo entity) { using (_context) { _context.BackgroundInfo.AddAsync(entity); return(Save()); } }
/// <summary> /// Update Background info /// </summary> /// <param name="entity"></param> /// <returns></returns> public Task <bool> Update(BackgroundInfo entity) { using (_context) { _context.BackgroundInfo.Update(entity); return(Save()); } }
public void initialize(string name, CrewRole cr, BackgroundInfo bs) { Name = name; role = cr; Bio = bs; setSkills(); setDesc(); setBio(); }
public ActionResult GetCurrentPosition() { var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext())); var currentUser = manager.FindById(User.Identity.GetUserId()); int id = currentUser.UserInfo.Id; BackgroundInfo currentP = GetCurrentPositionData(id, true); return(Json(currentP, JsonRequestBehavior.AllowGet)); }
public static JsonData SerializeBg(BackgroundInfo bgnd) { var r = CreateObj(); if (bgnd.TexPageIndex.HasValue) { r["texture"] = bgnd.TexPageIndex.Value; } return(r); }
protected void init(string imagePath, Brush brush, string savePath, Font font, Point point, int fontSize = 10) { Info = new BackgroundInfo(); ImagePath = imagePath; Source = new BitmapImage(new Uri(ImagePath)); SavePath = savePath; Font = font; FontSize = fontSize; Brush = brush; Point = point; ensurePaths(); }
public BackgroundInstance(Board board, SerializationForm json) : base(board, json) { flip = json.flip; _a = json.a; _cx = json.cx; _cy = json.cy; _rx = json.rx; _ry = json.ry; _front = json.front; _type = json.type; baseInfo = BackgroundInfo.Get(json.bs, json.ani, json.no); }
/// <summary> /// On image selection changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bgSetListBox_SelectedIndexChanged(object sender, EventArgs e) { if (bgSetListBox.SelectedItem == null) { return; } bgImageContainer.Controls.Clear(); string path; BackgroundInfoType infoType = BackgroundInfoType.Animation; if (radioButton_spine.Checked) { infoType = BackgroundInfoType.Spine; path = "spine"; } else if (aniBg.Checked) { infoType = BackgroundInfoType.Animation; path = "ani"; } else { infoType = BackgroundInfoType.Background; path = "back"; } WzImageProperty parentProp = Program.InfoManager.BackgroundSets[(string)bgSetListBox.SelectedItem][path]; if (parentProp == null || parentProp.WzProperties == null) { return; } foreach (WzImageProperty prop in parentProp.WzProperties) { BackgroundInfo bgInfo = BackgroundInfo.Get((string)bgSetListBox.SelectedItem, infoType, prop.Name); if (bgInfo == null) { continue; } ImageViewer item = bgImageContainer.Add(bgInfo.Image, prop.Name, true); item.Tag = bgInfo; item.MouseDown += new MouseEventHandler(bgItem_Click); item.MouseUp += new MouseEventHandler(ImageViewer.item_MouseUp); item.MaxHeight = UserSettings.ImageViewerHeight; item.MaxWidth = UserSettings.ImageViewerWidth; } }
public BackgroundInstance(BackgroundInfo baseInfo, Board board, int x, int y, int z, int rx, int ry, int cx, int cy, BackgroundType type, int a, bool front, bool flip) : base(board, x, y, z) { this.baseInfo = baseInfo; this.flip = flip; _rx = rx; _ry = ry; _cx = cx; _cy = cy; _a = a; _type = type; _front = front; if (flip) BaseX -= Width - 2 * Origin.X; }
public void SetBG(string tag) { image = GetComponent <Image>(); BackgroundInfo info = bgsInfo[0]; foreach (BackgroundInfo bi in bgsInfo) { if (bi.tag == tag) { info = bi; break; } } SetValues(info); }
private void bgSetListBox_SelectedIndexChanged(object sender, EventArgs e) { if (bgSetListBox.SelectedItem == null) { return; } bgImageContainer.Controls.Clear(); WzImage bgSetImage = Program.InfoManager.BackgroundSets[(string)bgSetListBox.SelectedItem]; if (!bgSetImage.Parsed) { bgSetImage.ParseImage(); } if (aniBg.Checked) { IWzImageProperty aniProp = bgSetImage["ani"]; if (aniProp == null || aniProp.WzProperties == null) { return; } foreach (WzSubProperty aniBgProp in aniProp.WzProperties) { if (aniBgProp.HCTag == null) { aniBgProp.HCTag = BackgroundInfo.Load(aniBgProp, (string)bgSetListBox.SelectedItem, true, aniBgProp.Name); } KoolkLVItem aniItem = bgImageContainer.createItem(((BackgroundInfo)aniBgProp.HCTag).Image, aniBgProp.Name, true); aniItem.Tag = aniBgProp.HCTag; aniItem.MouseDown += new MouseEventHandler(bgItem_Click); aniItem.MouseUp += new MouseEventHandler(item_MouseUp); } } else { IWzImageProperty backProp = bgSetImage["back"]; foreach (WzCanvasProperty backBg in backProp.WzProperties) { if (backBg.HCTag == null) { backBg.HCTag = BackgroundInfo.Load(backBg, (string)bgSetListBox.SelectedItem, false, backBg.Name); } KoolkLVItem aniItem = bgImageContainer.createItem(((BackgroundInfo)backBg.HCTag).Image, backBg.Name, true); aniItem.Tag = backBg.HCTag; aniItem.MouseDown += new MouseEventHandler(bgItem_Click); aniItem.MouseUp += new MouseEventHandler(item_MouseUp); } } }
public BackgroundInstance(BackgroundInfo baseInfo, Board board, int x, int y, int z, int rx, int ry, int cx, int cy, BackgroundType type, int a, bool front, bool flip) : base(board, x, y, z) { this.baseInfo = baseInfo; this.flip = flip; _rx = rx; _ry = ry; _cx = cx; _cy = cy; _a = a; _type = type; _front = front; if (flip) { BaseX -= Width - 2 * Origin.X; } }
public BackgroundInstance(Board board, SerializationForm json) : base(board, json) { flip = json.flip; _a = json.a; _cx = json.cx; _cy = json.cy; _rx = json.rx; _ry = json.ry; _front = json.front; _type = json.type; _screenMode = json.screenMode; _spineAni = json.spineAni; _spineRandomStart = json.spineRandomStart; baseInfo = BackgroundInfo.Get(board.ParentControl.GraphicsDevice, json.bs, json.backgroundInfoType, json.no); }
public void AddBackgroundInfo(BackgroundInfo BackgroundInfoClient) { var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext())); var currentUser = manager.FindById(User.Identity.GetUserId()); int id = currentUser.UserInfo.Id; BackgroundInfo bi = new BackgroundInfo(); bi.UserInfoID = id; bi.title = BackgroundInfoClient.title; bi.type = BackgroundInfoClient.type; bi.startDate = BackgroundInfoClient.startDate; bi.endDate = BackgroundInfoClient.endDate; bi.description = BackgroundInfoClient.description; bi.isCurrentPosition = false; BackgroundInfoBusinessLayer biBal = new BackgroundInfoBusinessLayer(); biBal.InsertBackgroundInfo(bi); }
public void AddCurrentPositionData(BackgroundInfo BackgroundInfoClient) { var manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext())); var currentUser = manager.FindById(User.Identity.GetUserId()); int id = currentUser.UserInfo.Id; BackgroundInfo bi = new BackgroundInfo(); bi.UserInfoID = id; bi.type = BackgroundInfoClient.type; bi.title = BackgroundInfoClient.title; bi.endDate = new DateTime(2013, 02, 08); bi.startDate = BackgroundInfoClient.startDate; bi.description = BackgroundInfoClient.description; bi.isCurrentPosition = true; bi.createdDate = DateTime.Now; bi.updatedDate = null; CurrentPositionBusinessLayer cpBal = new CurrentPositionBusinessLayer(); cpBal.InsertCurrentPosition(bi); }
public BackgroundInstance(BackgroundInfo baseInfo, Board board, int x, int y, int z, int rx, int ry, int cx, int cy, BackgroundType type, int a, bool front, bool flip, int _screenMode, string _spineAni, bool _spineRandomStart) : base(board, x, y, z) { this.baseInfo = baseInfo; this.flip = flip; this._rx = rx; this._ry = ry; this._cx = cx; this._cy = cy; this._a = a; this._type = type; this._front = front; this._screenMode = _screenMode; this._spineAni = _spineAni; this._spineRandomStart = _spineRandomStart; if (flip) BaseX -= Width - 2 * Origin.X; }
private static void LoadBackgrounds(WzImage mapImage, Board mapBoard) { WzSubProperty bgParent = (WzSubProperty)mapImage["back"]; WzSubProperty bgProp; int i = 0; while ((bgProp = (WzSubProperty)bgParent[(i++).ToString()]) != null) { int x = InfoTool.GetInt(bgProp["x"]); int y = InfoTool.GetInt(bgProp["y"]); int rx = InfoTool.GetInt(bgProp["rx"]); int ry = InfoTool.GetInt(bgProp["ry"]); int cx = InfoTool.GetInt(bgProp["cx"]); int cy = InfoTool.GetInt(bgProp["cy"]); int a = InfoTool.GetInt(bgProp["a"]); BackgroundType type = (BackgroundType)InfoTool.GetInt(bgProp["type"]); bool front = InfoTool.GetBool(bgProp["front"]); bool flip = InfoTool.GetBool(bgProp["f"]); string bS = InfoTool.GetString(bgProp["bS"]); bool ani = InfoTool.GetBool(bgProp["ani"]); string no = InfoTool.GetInt(bgProp["no"]).ToString(); WzImage bsImg = Program.InfoManager.BackgroundSets[bS]; if (bsImg == null) { continue; } IWzImageProperty bgInfoProp = bsImg[ani ? "ani" : "back"][no]; if (bgInfoProp.HCTag == null) { bgInfoProp.HCTag = BackgroundInfo.Load(bgInfoProp, bS, ani, no); } BackgroundInfo bgInfo = (BackgroundInfo)bgInfoProp.HCTag; IList list = front ? mapBoard.BoardItems.FrontBackgrounds : mapBoard.BoardItems.BackBackgrounds; list.Add((BackgroundInstance)bgInfo.CreateInstance(mapBoard, x, y, i, rx, ry, cx, cy, type, a, front, flip, false)); } }
// Use this for initialization void Start() { instance = GetComponent <BackgroundInfo>(); SetInfo(); }
public void UpdateBackgroundInfo(BackgroundInfo BackgroundInfoClient) { BackgroundInfoBusinessLayer biBal = new BackgroundInfoBusinessLayer(); biBal.UpdateBackgroundInfo(BackgroundInfoClient); }
public static GMFile /* errors: different return type? */ ReadFile(string baseDir, JsonData projFile) { var f = new GMFile(); // OBJT: depends on SPRT, obj<->id map // ROOM: depends on OBJT, BGND // SCPT: depends on CODE if (projFile.Has("chunkorder") && projFile["chunkorder"].IsArray) { f.ChunkOrder = DeserializeArray(projFile["chunkorder"], jd => SectionHeadersExtensions.FromChunkName((string)jd)); } else { Console.Error.WriteLine("Warning: Project file doesn't have a chunk order. You should export with a newer Altar.NET version."); f.ChunkOrder = new SectionHeaders[] { SectionHeaders.General, SectionHeaders.Options, SectionHeaders.Language, SectionHeaders.Extensions, SectionHeaders.Sounds, SectionHeaders.AudioGroup, SectionHeaders.Sprites, SectionHeaders.Backgrounds, SectionHeaders.Paths, SectionHeaders.Scripts, SectionHeaders.Globals, SectionHeaders.Shaders, SectionHeaders.Fonts, SectionHeaders.Timelines, SectionHeaders.Objects, SectionHeaders.Rooms, SectionHeaders.DataFiles, SectionHeaders.TexturePage, SectionHeaders.Code, SectionHeaders.Variables, SectionHeaders.Functions, SectionHeaders.Strings, SectionHeaders.Textures, SectionHeaders.Audio, SectionHeaders.EmbedImage, }; } if (projFile.Has("general")) { Console.WriteLine("Loading general..."); try { f.General = DeserializeGeneral(LoadJson(baseDir, (string)(projFile["general"]))); if (f.General.Version >= new Version(2, 0)) { Console.Error.WriteLine("Warning: GM:S 2.0 support is incomplete!"); } } catch (Exception) { Console.Error.WriteLine("Error loading general"); throw; } } if (projFile.Has("options")) { Console.WriteLine("Loading options..."); try { f.Options = DeserializeOptions(LoadJson(baseDir, (string)(projFile["options"]))); } catch (Exception) { Console.Error.WriteLine("Error loading options"); throw; } } if (projFile.Has("strings")) { Console.WriteLine("Loading strings..."); try { f.Strings = DeserializeArray(LoadJson(baseDir, (string)(projFile["strings"])), jd => (string)jd); } catch (Exception) { Console.Error.WriteLine("Error loading strings"); throw; } } var variables = new ReferenceDef[0]; var functions = new ReferenceDef[0]; if (projFile.Has("variables")) { Console.WriteLine("Loading variables..."); try { var vardata = LoadJson(baseDir, (string)(projFile["variables"])); variables = DeserializeArray(vardata.IsArray ? vardata : vardata["variables"], DeserializeReferenceDef); if (vardata.Has("extra")) { f.VariableExtra = DeserializeArray(vardata["extra"], jd => (uint)jd); } } catch (Exception) { Console.Error.WriteLine("Error loading variables"); throw; } } if (projFile.Has("functions")) { Console.WriteLine("Loading functions..."); try { var funcdata = LoadJson(baseDir, (string)(projFile["functions"])); functions = DeserializeArray(funcdata.IsArray ? funcdata : funcdata["functions"], DeserializeReferenceDef); if (funcdata.Has("locals")) { f.FunctionLocals = DeserializeArray(funcdata["locals"], DeserializeFuncLocals); } } catch (Exception) { Console.Error.WriteLine("Error loading functions"); throw; } } f.RefData = new RefData { Variables = variables, Functions = functions }; if (projFile.Has("textures")) { Console.WriteLine("Loading textures..."); var textures = projFile["textures"].ToArray(); var ts = new TextureInfo[textures.Length]; for (int i = 0; i < textures.Length; i++) { try { var texinfo = new TextureInfo { PngData = File.ReadAllBytes(Path.Combine(baseDir, (string)(textures[i]))) }; var bp = new UniquePtr(texinfo.PngData); unsafe { var png = (PngHeader *)bp.BPtr; texinfo.Width = Utils.SwapEnd32(png->IHDR.Width); texinfo.Height = Utils.SwapEnd32(png->IHDR.Height); } ts[i] = texinfo; } catch (Exception) { Console.Error.WriteLine($"Error loading {textures[i]}"); throw; } } f.Textures = ts; } if (projFile.Has("tpags")) { Console.Write("Loading texture pages... "); var cl = Console.CursorLeft; var ct = Console.CursorTop; var tpags = projFile["tpags"].ToArray(); var tps = new TexturePageInfo[tpags.Length]; for (int i = 0; i < tpags.Length; i++) { Console.SetCursorPosition(cl, ct); Console.WriteLine(O_PAREN + (i + 1) + SLASH + tpags.Length + C_PAREN); try { tps[i] = DeserializeTPag(LoadJson(baseDir, (string)(tpags[i]))); } catch (Exception) { Console.Error.WriteLine($"Error loading {tpags[i]}"); throw; } } f.TexturePages = tps; } if (projFile.Has("audio")) { Console.WriteLine("Loading audio..."); var audio = projFile["audio"].ToArray(); var ais = new AudioInfo[audio.Length]; for (int i = 0; i < audio.Length; i++) { try { var audioinfo = new AudioInfo { Wave = File.ReadAllBytes(Path.Combine(baseDir, (string)(audio[i]))) }; ais[i] = audioinfo; } catch (Exception) { Console.Error.WriteLine($"Error loading {audio[i]}"); throw; } } f.Audio = ais; } if (projFile.Has("sprites")) { Console.Write("Loading sprites... "); var cl = Console.CursorLeft; var ct = Console.CursorTop; var sprites = projFile["sprites"].ToArray(); var ss = new SpriteInfo[sprites.Length]; for (int i = 0; i < sprites.Length; i++) { Console.SetCursorPosition(cl, ct); Console.WriteLine(O_PAREN + (i + 1) + SLASH + sprites.Length + C_PAREN); try { ss[i] = DeserializeSprite(LoadJson(baseDir, (string)(sprites[i]))); ss[i].Name = Path.GetFileNameWithoutExtension((string)(sprites[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {sprites[i]}"); throw; } } f.Sprites = ss; } if (projFile.Has("objs")) { Console.Write("Loading objects... "); var cl = Console.CursorLeft; var ct = Console.CursorTop; var objs = projFile["objs"].ToArray(); var objNames = objs.Select(o => Path.GetFileNameWithoutExtension((string)o)).ToArray(); var os = new ObjectInfo[objs.Length]; for (int i = 0; i < objs.Length; i++) { Console.SetCursorPosition(cl, ct); Console.WriteLine(O_PAREN + (i + 1) + SLASH + objs.Length + C_PAREN); try { os[i] = DeserializeObj( LoadJson(baseDir, (string)(objs[i])), f.Sprites, s => (uint)Array.IndexOf(objNames, s)); os[i].Name = objNames[i]; } catch (Exception) { Console.Error.WriteLine($"Error loading {objs[i]}"); throw; } } f.Objects = os; } if (projFile.Has("code")) { Console.WriteLine("Loading code..."); var code = projFile["code"].ToArray(); var cs = new CodeInfo[code.Length]; var strings = new StringsListBuilder(); strings.AddStrings(f.Strings); IDictionary <string, uint> objectIndices = new Dictionary <string, uint>(f.Objects.Length); for (uint i = 0; i < f.Objects.Length; i++) { objectIndices[f.Objects[i].Name] = i; } for (int i = 0; i < code.Length; i++) { Console.WriteLine((string)(code[i])); try { cs[i] = Assembler.DeserializeCodeFromFile(Path.Combine(baseDir, (string)(code[i])), f.General.BytecodeVersion, strings, objectIndices); cs[i].Name = Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension((string)(code[i]))); cs[i].ArgumentCount = 1; if (f.FunctionLocals != null) { for (int j = 0; j < f.FunctionLocals.Length; j++) { int fastIndex = (j + i) % f.FunctionLocals.Length; if (f.FunctionLocals[fastIndex].FunctionName == cs[i].Name) { cs[i].ArgumentCount = f.FunctionLocals[fastIndex].LocalNames.Length; break; } } } } catch (Exception) { Console.Error.WriteLine($"Error loading {code[i]}"); throw; } } f.Code = cs; f.Strings = strings.GetStrings(); } if (projFile.Has("sounds")) { Console.WriteLine("Loading sounds..."); var sounds = projFile["sounds"].ToArray(); var ss = new SoundInfo[sounds.Length]; for (int i = 0; i < sounds.Length; i++) { try { ss[i] = DeserializeSound(LoadJson(baseDir, (string)(sounds[i]))); ss[i].Name = Path.GetFileNameWithoutExtension((string)(sounds[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {sounds[i]}"); throw; } } f.Sound = ss; } if (projFile.Has("bg")) { Console.WriteLine("Loading backgrounds..."); var bg = projFile["bg"].ToArray(); var bs = new BackgroundInfo[bg.Length]; for (int i = 0; i < bg.Length; i++) { try { bs[i] = DeserializeBg(LoadJson(baseDir, (string)(bg[i]))); bs[i].Name = Path.GetFileNameWithoutExtension((string)(bg[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {bg[i]}"); throw; } } f.Backgrounds = bs; } if (projFile.Has("paths")) { Console.WriteLine("Loading paths..."); var paths = projFile["paths"].ToArray(); var ps = new PathInfo[paths.Length]; for (int i = 0; i < paths.Length; i++) { try { ps[i] = DeserializePath(LoadJson(baseDir, (string)(paths[i]))); ps[i].Name = Path.GetFileNameWithoutExtension((string)(paths[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {paths[i]}"); throw; } } f.Paths = ps; } if (projFile.Has("scripts")) { Console.WriteLine("Loading scripts..."); var scripts = projFile["scripts"].ToArray(); var ss = new ScriptInfo[scripts.Length]; for (int i = 0; i < scripts.Length; i++) { try { ss[i] = DeserializeScript(LoadJson(baseDir, (string)(scripts[i])), f.Code); ss[i].Name = Path.GetFileNameWithoutExtension((string)(scripts[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {scripts[i]}"); throw; } } f.Scripts = ss; } if (projFile.Has("fonts")) { Console.WriteLine("Loading fonts..."); var fonts = projFile["fonts"].ToArray(); var fs = new FontInfo[fonts.Length]; for (int i = 0; i < fonts.Length; i++) { try { fs[i] = DeserializeFont(LoadJson(baseDir, (string)(fonts[i]))); fs[i].CodeName = Path.GetFileNameWithoutExtension((string)(fonts[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {fonts[i]}"); throw; } } f.Fonts = fs; } if (projFile.Has("rooms")) { Console.Write("Loading rooms... "); var cl = Console.CursorLeft; var ct = Console.CursorTop; var rooms = projFile["rooms"].ToArray(); var rs = new RoomInfo[rooms.Length]; for (int i = 0; i < rooms.Length; i++) { Console.SetCursorPosition(cl, ct); Console.WriteLine(O_PAREN + (i + 1) + SLASH + rooms.Length + C_PAREN); try { rs[i] = DeserializeRoom(LoadJson(baseDir, (string)(rooms[i])), f.Backgrounds, f.Objects); rs[i].Name = Path.GetFileNameWithoutExtension((string)(rooms[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {rooms[i]}"); throw; } } f.Rooms = rs; } if (projFile.Has("audiogroups")) { Console.WriteLine("Loading audio groups..."); try { f.AudioGroups = DeserializeArray(LoadJson(baseDir, (string)(projFile["audiogroups"])), jd => (string)jd); } catch (Exception) { Console.Error.WriteLine("Error loading audio groups"); throw; } } if (projFile.Has("shaders")) { Console.WriteLine("Loading shaders..."); var shaders = projFile["shaders"].ToArray(); var ss = new ShaderInfo[shaders.Length]; for (int i = 0; i < shaders.Length; i++) { try { ss[i] = DeserializeShader(LoadJson(baseDir, (string)(shaders[i]))); ss[i].Name = Path.GetFileNameWithoutExtension((string)(shaders[i])); } catch (Exception) { Console.Error.WriteLine($"Error loading {shaders[i]}"); throw; } } f.Shaders = ss; } return(f); }
/// <summary> /// テキスト効果の設定 /// </summary> /// <param name="condition"></param> /// <param name="matche"></param> void _SetTextEffect( LineCondition condition, Match matche ) { // 文字色の設定 if( condition.Effect.Foreground != null ) { FormattedText.SetForegroundBrush( condition.Effect.Foreground, matche.Index, matche.Length ); } // 背景色の設定 if( condition.Effect.Background != null ) { var backgroundInfo = new BackgroundInfo() { Index = matche.Index, Length = matche.Length, ColorBrush = condition.Effect.Background, }; m_backgroundInfos.Add( backgroundInfo ); } // フォントサイズの設定 if( condition.Effect.FontScale != -1 ) { FormattedText.SetFontSize( FontSize * condition.Effect.FontScale, matche.Index, matche.Length ); } // フォント幅の設定 if( condition.Effect.FontWeight != null ) { FormattedText.SetFontWeight( (FontWeight)condition.Effect.FontWeight, matche.Index, matche.Length ); } }
public void UpdateCurrentPosition(BackgroundInfo CurrentPositionClient) { CurrentPositionBusinessLayer cpbl = new CurrentPositionBusinessLayer(); cpbl.UpdateCurrentPosition(CurrentPositionClient); }
public void Match(string line) { if (line.StartsWith("//")) { var section = line.Trim(); switch (section) { case SectionBgVideo: _currentSection = SectionBgVideo; break; case SectionBreak: _currentSection = SectionBreak; break; case SectionSbSamples: //todo: use OsbLib like: "ElementGroup eg = new ElementGroup(_sbInfo.ToString());" _currentSection = SectionSbSamples; break; default: if (section.StartsWith(SectionStoryboard)) { _currentSection = SectionStoryboard; _sbInfo.AppendLine(line); } else { _currentSection = section; _unknownSection.Add(section, new StringBuilder()); } break; } } else { switch (_currentSection) { case SectionBgVideo: if (line.StartsWith("Video,")) { var infos = line.Split(','); VideoInfo = new VideoInfo { Offset = double.Parse(infos[1]), Filename = infos[2].Trim('"') }; } else { var infos = line.Split(','); double x = 0, y = 0; if (infos.Length > 3) { x = double.Parse(infos[3]); y = double.Parse(infos[4]); } BackgroundInfo = new BackgroundInfo { Unknown1 = infos[0], Unknown2 = infos[1], Filename = infos[2].Trim('"'), X = x, Y = y }; } break; case SectionBreak: { var infos = line.Split(','); Breaks.Add(new OsuFile.TimeRange(double.Parse(infos[1]), double.Parse(infos[2]))); } break; case SectionSbSamples: if (line.StartsWith("Sample,")) { var infos = line.Split(','); SampleInfo.Add(new SbSampleInfo { Offset = int.Parse(infos[1]), MagicalInt = int.Parse(infos[2]), Filename = infos[3].Trim('"'), Volume = int.Parse(infos[4]), }); } break; case SectionStoryboard: _sbInfo.AppendLine(line); break; default: _unknownSection[_currentSection].AppendLine(line); break; } } }
public void Search( Regex searchRegex ) { m_searchInfos = null; if( searchRegex == null ) { return; } var matches = searchRegex.Matches( FormattedText.Text ); foreach( Match matche in matches ) { var backgroundInfo = new BackgroundInfo() { Index = matche.Index, Length = matche.Length, ColorBrush = Brushes.Yellow, }; if( m_searchInfos == null ) { m_searchInfos = new List<BackgroundInfo>(); } m_searchInfos.Add( backgroundInfo ); } }
public BackgroundInstanceEditor(BackgroundInstance item) { InitializeComponent(); this.item = item; xInput.Value = item.BaseX; yInput.Value = item.BaseY; if (item.Z == -1) { zInput.Enabled = false; } else { zInput.Value = item.Z; } pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item); typeBox.Items.AddRange((object[])Tables.BackgroundTypeNames.Cast <object>()); typeBox.SelectedIndex = (int)item.type; alphaBox.Value = item.a; front.Checked = item.front; rxBox.Value = item.rx; ryBox.Value = item.ry; cxBox.Value = item.cx; cyBox.Value = item.cy; // Resolutions foreach (RenderResolution val in Enum.GetValues(typeof(RenderResolution))) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Tag = val; comboBoxItem.Content = val.ToString().Replace("Res_", "").Replace("_", " ").Replace("PercScaled", "% scale"); comboBox_screenMode.Items.Add(comboBoxItem); } comboBox_screenMode.DisplayMember = "Content"; int i = 0; foreach (ComboBoxItem citem in comboBox_screenMode.Items) { if ((int)((RenderResolution)citem.Tag) == item.screenMode) { comboBox_screenMode.SelectedIndex = i; break; } i++; } if (item.screenMode < 0) { comboBox_screenMode.SelectedIndex = 0; } // Spine BackgroundInfo baseInfo = (BackgroundInfo)item.BaseInfo; if (baseInfo.WzSpineAnimationItem == null) { groupBox_spine.Enabled = false; // disable editing } else { groupBox_spine.Enabled = true; // editing foreach (Animation ani in baseInfo.WzSpineAnimationItem.SkeletonData.Animations) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Tag = ani; comboBoxItem.Content = ani.Name; comboBox_spineAnimation.Items.Add(comboBoxItem); } comboBox_spineAnimation.DisplayMember = "Content"; int i_animation = 0; foreach (ComboBoxItem citem in comboBox_spineAnimation.Items) { if (((Animation)citem.Tag).Name == item.SpineAni) { comboBox_spineAnimation.SelectedIndex = i_animation; break; } i_animation++; } // spineRandomStart checkbox checkBox_spineRandomStart.Checked = item.SpineRandomStart; } }
void PackBackgroundData() { backInfo = new BackgroundInfo[6]; Image[] imgs = bgcontainer.GetComponentsInChildren<Image>(); Debug.Log(imgs.Length); for (int i = 0; i < 6; i++) { backInfo[i] = new BackgroundInfo(); backInfo[i].col = imgs[i].color; backInfo[i].source = imgs[i].sprite; backInfo[i].yval = imgs[i].transform.parent.GetComponent<RectTransform>().localPosition.y; } }
public void SetValues(BackgroundInfo info) { image.color = info.color; image.sprite = info.sprite; current = info; }