private void LoadResources(object obj) { GameFramework g = (GameFramework)obj; g.StoreTexture("AptimaLogo", g.CreateTexture( this.GetType().Assembly.GetManifestResourceStream("DDD_GUI.images.AptimaLogo.jpg"))); Quit(); }
public void LoadTextures(object obj) { string path = string.Empty; try { path = string.Format("{0}\\{1}.dll", DDD_Global.Instance.DDDClientShareFolder, DDD_Global.Instance.ImageLibrary); if (!File.Exists(path)) { path = string.Format(@"{0}\DDDClient\{1}.dll", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), DDD_Global.Instance.ImageLibrary); } ImageLib = Assembly.LoadFile(path); } catch (Exception e) { lock (this) { SceneMode = MODE.SCENE_ERROR; Message = "Missing Image Libary"; MsgColor = Color.Red; Thread.Sleep(2000); throw new Exception(Message + ":" + path + ":" + e.Message); } return; } GameFramework g = (GameFramework)obj; GameTexture _texture; List <string> names = new List <string>(); try { StreamReader s = new StreamReader(ImageLib.GetManifestResourceStream("ImageLibrary.mf")); while (!s.EndOfStream) { names.Add(s.ReadLine()); } for (int i = 0; i < names.Count; i++) { string[] texture_name = names[i].Split(':'); _texture = g.CreateTexture(ImageLib.GetManifestResourceStream(texture_name[0])); _texture.rotate = bool.Parse(texture_name[1]); g.StoreTexture(texture_name[0], _texture); lock (this) { Message = string.Format("Texture {0} of {1}", i + 1, names.Count); } } s.Close(); } catch (Exception) { lock (this) { SceneMode = MODE.SCENE_ERROR; Message = "Error loading texture"; MsgColor = Color.Red; } return; } lock (this) { Stage = LoadingStage.BACKGROUND; } bool continue_looping = true; GameTexture Map; while (continue_looping) { if (DDD_Global.Instance.MapLocation != string.Empty) { try { if (File.Exists(DDD_Global.Instance.MapLocation)) { Map = g.CreateTexture(DDD_Global.Instance.MapLocation); } else { Map = g.CreateTexture(string.Format("{0}\\MapLib\\{1}", DDD_Global.Instance.DDDClientShareFolder, DDD_Global.Instance.MapName)); } Controller.UTM_Mapping.ImageHeight = Map.height; Controller.UTM_Mapping.ImageWidth = Map.width; g.StoreTexture("MAP", Map); continue_looping = false; } catch (Exception) { SceneMode = MODE.SCENE_ERROR; Message = "Map file missing: " + DDD_Global.Instance.MapName; MsgColor = Color.Red; continue_looping = false; Thread.Sleep(2000); throw new Exception(Message); } } else { Thread.Sleep(2000); } } lock (this) { Stage = LoadingStage.FINISHED; DDD_RangeRings.SetCanvasPtr(GameFramework.Instance().CANVAS); } }
public void LoadTextures(object obj) { GameFramework g = (GameFramework)obj; GameTexture _texture; List <string> names = new List <string>(); try { StreamReader s = new StreamReader(ImageLib.GetManifestResourceStream("ImageLibrary.mf")); while (!s.EndOfStream) { names.Add(s.ReadLine()); } for (int i = 0; i < names.Count; i++) { _texture = g.CreateTexture(ImageLib.GetManifestResourceStream(names[i])); g.StoreTexture(names[i], _texture); lock (this) { Message = string.Format("Texture {0} of {1}", i + 1, names.Count); } } s.Close(); } catch (Exception) { lock (this) { SceneMode = MODE.SCENE_ERROR; Message = "Error loading texture"; MsgColor = Color.Red; } return; } lock (this) { Stage = LoadingStage.BACKGROUND; } try { GameTexture Map = g.CreateTexture(DDD_Global.Instance.MapLocation); Controller.UTM_Mapping.ImageHeight = Map.height; Controller.UTM_Mapping.ImageWidth = Map.width; g.StoreTexture("MAP", Map); } catch (ArgumentException) { lock (this) { SceneMode = MODE.SCENE_ERROR; Message = "Map file missing: " + DDD_Global.Instance.MapName; MsgColor = Color.Red; } return; } lock (this) { Stage = LoadingStage.FINISHED; } }