public static string GetFormattedString(ResourceID name, params object[] args) { Exception exception = null; try { string format = staticResourceManager.GetString(name.ToString(), CultureInfo.CurrentUICulture); return((format != null) ? string.Format(CultureInfo.CurrentUICulture, format, args) : name.ToString()); } catch (InvalidOperationException exception2) { exception = exception2; } catch (MissingManifestResourceException exception3) { exception = exception3; } catch (FormatException exception4) { exception = exception4; } if (exception == null) { return(name.ToString()); } StringBuilder builder = new StringBuilder(); builder.Append(name.ToString()); foreach (object obj2 in ArrayList.Adapter(args)) { builder.Append(" "); builder.Append(obj2.ToString()); } return(builder.ToString()); }
public void Process(ResourceID id) { reader = Burntime.Platform.IO.FileSystem.GetFile(id.File).GetSubFile(0, -1); charInfo = new Dictionary <char, CharInfo>(); chars = new CharInfo[98]; for (int i = 0; i < 98; i++) { chars[i].pos = reader.ReadUShort(); chars[i].width = reader.ReadUShort(); charInfo.Add((char)(' ' + i), chars[i]); } for (int i = 0; i < 98; i++) { reader.Seek(chars[i].pos, Burntime.Platform.IO.SeekPosition.Begin); int unknown1 = reader.ReadUShort(); int unknown2 = reader.ReadUShort(); chars[i].imgWidth = 4 * (unknown1 + 1); chars[i].imgHeight = unknown2; } }
public RawImageResource(PsdBinaryReader reader, string signature, ResourceID resourceId, string name, int numBytes) : base(name) { this.Signature = signature; this.id = resourceId; Data = reader.ReadBytes(numBytes); }
public static ResourceID Make(params object[] parts) { string idStr = StringUtils.ConnectToStringWithSeparator(SEPARATOR, parts); ResourceID resID = _cachedResID[idStr]; if (resID == null) { resID = new ResourceID(); resID.parts = new List <object>(); resID.IDStr = idStr; string[] splits = resID.IDStr.Split('/'); for (int i = 0; i < splits.Length; i++) { int id; if (int.TryParse(splits[i], out id)) { resID.parts.Add(id); } else { resID.parts.Add(splits[i]); } } _cachedResID[idStr] = resID; } return(resID); }
public void Process(ResourceID ID) { if (ID.EndIndex == -1) { frameCount = 1; } else { frameCount = ID.EndIndex - ID.Index + 1; } frameOffset = ID.Index; progressive = ID.Custom == "p"; File file = FileSystem.GetFile(ID.File); raw = new RawImageFileReader(file); raw.ReadHeader(); if (!ID.IndexProvided) { frameCount = raw.ImageCount; } size = new Vector2(); lastFrame = null; }
public string[] ToArray(string statsBasedOn) { List <string> list = new List <string> { ResourceID.ToString(), ProcessTechID.ToString(), LabID.ToString(), ResourceName, ProcessTechName }; switch (statsBasedOn) { case "charged": list.AddRange(Activities.Select(x => x.ChargeDuration.ToString("#0.000")).ToArray()); break; case "scheduled": list.AddRange(Activities.Select(x => x.SchedDuration.ToString("#0.000")).ToArray()); break; case "actual": list.AddRange(Activities.Select(x => x.ActDuration.ToString("#0.000")).ToArray()); break; } list.Add(GetTotal(statsBasedOn).ToString("#0.000")); return(list.ToArray()); }
public DataObject Process(ResourceID id, ResourceManager resourceManager) { ConfigFile file = new ConfigFile(); file.Open(id.File); return(new Constructions(file)); }
internal Sprite(ResourceManager ResMan, String ID, SpriteFrame Frame) { id = ID; internalFrames = new SpriteFrame[1]; internalFrames[0] = Frame; resMan = ResMan; }
public DataObject Process(ResourceID ID, ResourceManager ResourceManager) { File file = FileSystem.GetFile(ID.File); file.Seek(ID.Index * (16 + 32 * 32), SeekPosition.Begin); Tile tile = new Tile(file, 0); TileMaskData data = new TileMaskData(); data.Mask = new bool[16]; data.DataName = ID; bool mask = false; bool nomask = false; int value = tile.Mask; for (int i = 0; i < 16; i++, value >>= 1) { data.Mask[15 - i] = (value & 1) == 0; mask |= data.Mask[15 - i]; nomask |= !data.Mask[15 - i]; } if (mask && nomask) data.Type = TileMaskType.Complex; else { data.Type = mask ? TileMaskType.Simple : TileMaskType.None; } return data; }
internal Sprite(ResourceManager resMan, String id, SpriteFrame[] frames, SpriteAnimation animation) { this.id = id; internalFrames = frames; this.resMan = resMan; ani = animation; }
public override int GetHashCode() { unchecked { return(ResourceID.GetHashCode() * 397); } }
public DataObject Process(ResourceID id, ResourceManager resourceManager) { Danger danger; int value = 0; if (!int.TryParse(id.Custom, out value)) { Burntime.Platform.Log.Warning("DangerProcessor: custom parameter is not an integer."); } switch (id.File) { case "radiation": danger = new Danger(id.File, value, resourceManager.GetString("burn?408"), resourceManager.GetImage("inf.ani?3")); break; case "gas": danger = new Danger(id.File, value, resourceManager.GetString("burn?413"), resourceManager.GetImage("inf.ani?7")); break; default: throw new Burntime.Framework.BurntimeLogicException(); } return(danger); }
public DataObject Process(ResourceID ID, ResourceManager ResourceManager) { IDataProcessor processor = ResourceManager.GetDataProcessor("burngfxmap"); MapData data = processor.Process(ID, ResourceManager) as MapData; return(data); }
public DataObject Process(ResourceID id, ResourceManager resourceManager) { ConfigFile file = new ConfigFile(); file.Open(id.File); return(new ItemTypesData(file, resourceManager)); }
/// <summary> /// Checks if the object is using the same resource id, /// if true set it to no ressource selected. /// This is used to update ImageObjects when deleting a resource file. /// </summary> /// <param name="resID">The resource id to check for.</param> public void CheckResource(string resID) { if (ResourceID.Equals(resID)) { ResourceID = Resources.resourceList[0]; RenderObject(); } }
public static int ResourceIDToImageIndex(ResourceID id) { switch (id) { case ResourceID.FOLDER: return(1); } return(0); }
public override int WriteTo(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.WriteTo(Buffer, cursor); cursor += ResourceID.WriteTo(Buffer, cursor); return(cursor - StartIndex); }
//[MenuItem("AssetBundle/LuaPathIDGenerate", false, 0)] public static void LuaPathIDGenerate() { if (!Directory.Exists(ResourceID.holderAssetPath)) { Directory.CreateDirectory(ResourceID.holderAssetPath); } ResourceID.MakeAndReadFromResource(); AssetDatabase.Refresh(); }
/// <summary> /// 获取资源 /// </summary> /// <param name="resName">资源ID</param> /// <returns></returns> public Object GetAsset(ResourceID resName) { var assetInfo = GetAssetInfo(resName); if (assetInfo != null) { return(assetInfo.asset); } return(null); }
public DataObject Process(ResourceID id, ResourceManager resourceManager) { int value = 0; if (!int.TryParse(id.Custom, out value)) { Burntime.Platform.Log.Warning("DangerProtectionProcessor: custom parameter is not an integer."); } return(new DangerProtection(id.File.ToLower(), value * 0.01f)); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> public override int GetHashCode() { unchecked { var hashCode = (int)WorkSurfaceContext; hashCode = (hashCode * 397) ^ ServerID.GetHashCode(); hashCode = (hashCode * 397) ^ ResourceID.GetHashCode(); hashCode = (hashCode * 397) ^ EnvironmentID.GetHashCode(); return(hashCode); } }
/// <summary> /// GetHashCode /// </summary> /// <returns></returns> public override int GetHashCode() { unchecked { int result = 17; result = result * 23 + ResourceID.GetHashCode(); result = result * 23 + ((Value != null) ? Value.GetHashCode() : 0); result = result * 23 + ((Name != null) ? Name.GetHashCode() : 0); return(result); } }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(IResource other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ResourceID.Equals(other.ResourceID)); //&& Version.Equals(other.Version); }
public void CopyTo(Sprite Sprite) { Sprite.resMan = resMan; Sprite.id = id; Sprite.internalFrames = internalFrames; Sprite.LoadType = LoadType; if (ani != null) { Sprite.ani = new SpriteAnimation(ani.FrameCount); } Sprite.Resolution = Resolution; }
public bool Equals(IResource other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ResourceID.Equals(other.ResourceID)); }
/// <summary> /// 获取资源信息 /// </summary> /// <param name="resName">资源ID</param> /// <returns></returns> private AssetInfo GetAssetInfo(ResourceID resName) { for (int i = 0; i < _cachedAssets.Count; i++) { var assetInfo = _cachedAssets[i]; if (assetInfo.resName == resName) { return(assetInfo); } } return(null); }
/// <summary> /// 移除指定资源 /// </summary> /// <param name="resName">资源ID</param> public void Remove(ResourceID resName) { for (int i = 0; i < _cachedAssets.Count; i++) { var assetInfo = _cachedAssets[i]; if (assetInfo.resName == resName) { _cachedAssets.RemoveAt(i); break; } } }
public Thumbnail(PsdBinaryReader psdReader, ResourceID id, string name, int numBytes) : base(psdReader, "8BIM", id, name, numBytes) { using (var memoryStream = new MemoryStream(Data)) { using (var reader = new PsdBinaryReader(memoryStream, psdReader)) { const int HEADER_LENGTH = 28; var format = reader.ReadUInt32(); var width = reader.ReadUInt32(); var height = reader.ReadUInt32(); var widthBytes = reader.ReadUInt32(); var size = reader.ReadUInt32(); var compressedSize = reader.ReadUInt32(); var bitPerPixel = reader.ReadUInt16(); var planes = reader.ReadUInt16(); // Raw RGB bitmal if (format == 0) { Image = new Bitmap((int)width, (int)height, PixelFormat.Format24bppRgb); } // JPEG bitmap else if (format == 1) { byte[] imgData = reader.ReadBytes(numBytes - HEADER_LENGTH); using (MemoryStream stream = new MemoryStream(imgData)) { var bitmap = new Bitmap(stream); Image = (Bitmap)bitmap.Clone(); } // Reverse BGR pixels from old thumbnail format if (id == ResourceID.ThumbnailBgr) { //for(int y=0;y<m_thumbnailImage.Height;y++) // for (int x = 0; x < m_thumbnailImage.Width; x++) // { // Color c=m_thumbnailImage.GetPixel(x,y); // Color c2=Color.FromArgb(c.B, c.G, c.R); // m_thumbnailImage.SetPixel(x, y, c); // } } } else { throw new PsdInvalidException("Unknown thumbnail format."); } } } }
public override unsafe void ReadFrom(ref byte *Buffer) { base.ReadFrom(ref Buffer); byte len = Buffer[0]; Buffer++; ResourceIDs = new ResourceID[len]; for (int i = 0; i < len; i++) { ResourceIDs[i] = new ResourceID(ref Buffer); } }
public void Process(ResourceID ID) { file = FileSystem.GetFile(ID.File); pos = ID.Index; if (ID.Custom != null) { map = int.Parse(ID.Custom); } else { map = 0; } }
public Thumbnail(PsdBinaryReader psdReader, ResourceID id, string name, int numBytes) : base(psdReader, "8BIM", id, name, numBytes) { using (var memoryStream = new MemoryStream(Data)) using (var reader = new PsdBinaryReader(memoryStream, psdReader)) { const int HEADER_LENGTH = 28; var format = reader.ReadUInt32(); var width = reader.ReadUInt32(); var height = reader.ReadUInt32(); var widthBytes = reader.ReadUInt32(); var size = reader.ReadUInt32(); var compressedSize = reader.ReadUInt32(); var bitPerPixel = reader.ReadUInt16(); var planes = reader.ReadUInt16(); // Raw RGB bitmap if (format == 0) { Image = new Bitmap((int)width, (int)height, PixelFormat.Format24bppRgb); } // JPEG bitmap else if (format == 1) { byte[] imgData = reader.ReadBytes(numBytes - HEADER_LENGTH); using (MemoryStream stream = new MemoryStream(imgData)) { var bitmap = new Bitmap(stream); Image = (Bitmap)bitmap.Clone(); } // Reverse BGR pixels from old thumbnail format if (id == ResourceID.ThumbnailBgr) { //for(int y=0;y<m_thumbnailImage.Height;y++) // for (int x = 0; x < m_thumbnailImage.Width; x++) // { // Color c=m_thumbnailImage.GetPixel(x,y); // Color c2=Color.FromArgb(c.B, c.G, c.R); // m_thumbnailImage.SetPixel(x, y, c); // } } } else { throw new PsdInvalidException("Unknown thumbnail format."); } } }
/// <summary> /// Strong Construction /// </summary> /// <param name="myGameUI"></param> /// <param name="myDepth"></param> /// <param name="PositionAbs"></param> /// <param name="resImage">Resource of the UI button image</param> /// <param name="ClickCommand">Command string passed back in the click event</param> public NodeUIButton(GameUI myGameUI, int myDepth, VectorInt PositionAbs, ResourceID resImage, string ClickCommand) : base(myGameUI, myDepth) { imageNormal = myGameUI.ResourceFactory[resImage].DataAsImage; imageBack = myGameUI.ResourceFactory[ResourceID.GameButtonBackGround].DataAsImage; Size = new SizeInt(imageBack.Size); CurrentAbsolute = PositionAbs; clickCommand = ClickCommand; mouseOverBrush = myGameUI.ResourceFactory[ResourceID.GameButtonMouseOverBrush].DataAsBrush; maskEffect = null; toolTip = null; if (GameUI.Cursor != null) { GameUI.Cursor.OnClick += new EventHandler<NodeCursorEventArgs>(cursor_OnClick); } }
public override int ReadFrom(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; cursor += base.ReadFrom(Buffer, cursor); byte len = Buffer[cursor]; cursor++; ResourceIDs = new ResourceID[len]; for (int i = 0; i < len; i++) { ResourceIDs[i] = new ResourceID(Buffer, cursor); cursor += ResourceIDs[i].ByteLength; } return cursor - StartIndex; }
void OnResourceGained(ResourceID resource) { CollectedResources.AddResource(resource, 1); UpdateCollectedResourcesGUI(); }
public Thumbnail(ResourceID id, string name) : base(id, name) { }
public override void Reset() { _resourceID = default(ResourceID); }
public RawImageResource(ResourceID resourceId, string name) : base(name) { this.id = resourceId; }
/// <summary> /// Strong Contructor. /// Enforce the use of resource for images /// </summary> /// <param name="myGameUI"></param> /// <param name="myDepth"></param> /// <param name="resourceImage"></param> public NodeEffectImage(GameUI myGameUI, int myDepth, ResourceID resourceImage) : base(myGameUI, myDepth) { this.image = myGameUI.ResourceFactory[resourceImage].DataAsImage; this.Size = new SizeInt(image.Width, image.Height); }
public static int ResourceIDToImageIndex(ResourceID id) { switch (id) { case ResourceID.FOLDER: return 1; } return 0; }
public override unsafe void ReadFrom(ref byte* Buffer) { base.ReadFrom(ref Buffer); byte len = Buffer[0]; Buffer++; ResourceIDs = new ResourceID[len]; for (int i = 0; i < len; i++) ResourceIDs[i] = new ResourceID(ref Buffer); }
public int GetResource(ResourceID resource) { return resources[(int)resource]; }
public ResourceHudFormContent(ResourceID resourceID) : base(HudFormID.Resource) { ResourceID = resourceID; }
public void AddResource(ResourceID resource, int addAmount) { resources[(int)resource] += addAmount; }
public StatGroupsMessage(ResourceID[] ResourceIDs) : base(MessageTypeGameMode.StatGroups) { this.ResourceIDs = ResourceIDs; }
public void SetResource(ResourceID resource, int amount) { resources[(int)resource] = amount; }