static void Main(string[] args) { FFGImport d2e = new FFGImport(GameType.D2E, Platform.Windows, "."); d2e.Inspect(); if (d2e.ImportAvailable()) { Console.Write("D2E Import Avaialable"); } if (d2e.NeedImport()) { Console.Write("D2E Import Needed"); } if (d2e.Import(null)) { Console.Write("D2E Import Complete"); } FFGImport mom = new FFGImport(GameType.MoM, Platform.Windows, "."); mom.Inspect(); if (mom.ImportAvailable()) { Console.Write("MoM Import Avaialable"); } if (mom.NeedImport()) { Console.Write("MoM Import Needed"); } if (mom.Import(null)) { Console.Write("MoM Import Complete"); } }
public void Draw() { // This will destroy all Destroyer.Destroy(); Game game = Game.Get(); game.gameType = new NoGameType(); // Get the current content for games if (Application.platform == RuntimePlatform.OSXPlayer) { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.MacOS, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.MacOS, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); #if IA fcIA = new FFGImport(FFGAppImport.GameType.IA, Platform.MacOS, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); #endif } else if (Application.platform == RuntimePlatform.Android) { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.Android, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.Android, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); #if IA fcIA = new FFGImport(FFGAppImport.GameType.IA, Platform.Android, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); #endif } else { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.Windows, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.Windows, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); #if IA fcIA = new FFGImport(FFGAppImport.GameType.IA, Platform.Windows, Game.AppData() + Path.DirectorySeparatorChar, Application.isEditor); #endif } fcD2E.Inspect(); fcMoM.Inspect(); #if IA fcIA.Inspect(); #endif // Banner Image Sprite bannerSprite; Texture2D newTex = Resources.Load("sprites/banner") as Texture2D; GameObject banner = new GameObject("banner"); banner.tag = Game.DIALOG; banner.transform.SetParent(game.uICanvas.transform); RectTransform trans = banner.AddComponent <RectTransform>(); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 1 * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, (UIScaler.GetWidthUnits() - 18f) * UIScaler.GetPixelsPerUnit() / 2f, 18f * UIScaler.GetPixelsPerUnit()); banner.AddComponent <CanvasRenderer>(); UnityEngine.UI.Image image = banner.AddComponent <UnityEngine.UI.Image>(); bannerSprite = Sprite.Create(newTex, new Rect(0, 0, newTex.width, newTex.height), Vector2.zero, 1); image.sprite = bannerSprite; image.rectTransform.sizeDelta = new Vector2(18f * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); // first button y offset float offset = 12f; // Draw D2E button bool D2E_need_import = fcD2E.NeedImport(); bool D2E_import_available = fcD2E.ImportAvailable(); Color startColor = D2E_need_import ? Color.grey : Color.white; int fontSize = UIScaler.GetMediumFont(); UIElement ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() - 30) / 2, offset, 30, 3); // If we need to import we can't play this type if (!D2E_need_import) { ui.SetText(D2E_NAME, startColor); ui.SetButton(delegate { D2E(); }); } else { string message = ""; if (D2E_import_available) { message = D2E_NAME.Translate(); } else { message = D2E_NAME.Translate() + System.Environment.NewLine + D2E_APP_NOT_FOUND.Translate(); fontSize = (int)(UIScaler.GetMediumFont() / 1.05f); } ui.SetText(message, startColor); } ui.SetFontSize(fontSize); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui, startColor); // Draw D2E import button ui = new UIElement(); if (D2E_import_available || !D2E_need_import) { ui.SetLocation((UIScaler.GetWidthUnits() - 14) / 2, offset + 3.2f, 14, 2); StringKey keyText = D2E_need_import ? CONTENT_IMPORT : CONTENT_REIMPORT; ui.SetText(keyText); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { Import("D2E", !D2E_import_available); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui); } else // Import unavailable { // only install button for Android if (Application.platform == RuntimePlatform.Android) { ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() - 24) / 2, offset + 3.2f, 24, 1.3f); ui.SetText(CONTENT_INSTALL_VIA_GOOGLEPLAY, Color.red); ui.SetButton(delegate { GotoWebBrowser(D2E_APP_URL_ANDROID); }); new UIElementBorder(ui, Color.red); } else { // install and locate button for other systems ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() / 2) - 13, offset + 3.2f, 12, 1.3f); ui.SetText(CONTENT_INSTALL_VIA_STEAM, Color.red); ui.SetButton(delegate { GotoWebBrowser(D2E_APP_URL_STEAM); }); new UIElementBorder(ui, Color.red); ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() / 2) + 1, offset + 3.2f, 12, 1.3f); ui.SetText(CONTENT_LOCATE, Color.red); ui.SetButton(delegate { Import("D2E", true); }); new UIElementBorder(ui, Color.red); } } offset += 7f; // Draw MoM button bool MoM_need_import = fcMoM.NeedImport(); bool MoM_import_available = fcMoM.ImportAvailable(); startColor = MoM_need_import ? Color.grey : Color.white; fontSize = UIScaler.GetMediumFont(); ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() - 30) / 2, offset, 30, 3); // If we need to import we can't play this type if (!MoM_need_import) { ui.SetText(MOM_NAME, startColor); ui.SetButton(delegate { MoM(); }); } else { string message = ""; if (MoM_import_available) { message = MOM_NAME.Translate(); } else { message = MOM_NAME.Translate() + System.Environment.NewLine + MOM_APP_NOT_FOUND.Translate(); fontSize = (int)(UIScaler.GetMediumFont() / 1.05f); } ui.SetText(message, startColor); } ui.SetFontSize(fontSize); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui, startColor); // Draw MoM import button ui = new UIElement(); if (MoM_import_available || !MoM_need_import) { ui.SetLocation((UIScaler.GetWidthUnits() - 14) / 2, offset + 3.2f, 14, 2); StringKey keyText = MoM_need_import ? CONTENT_IMPORT : CONTENT_REIMPORT; ui.SetText(keyText); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { Import("MoM", !MoM_import_available); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui); } else // Import unavailable { // only install button for Android if (Application.platform == RuntimePlatform.Android) { ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() - 24) / 2, offset + 3.2f, 24, 1.3f); ui.SetText(CONTENT_INSTALL_VIA_GOOGLEPLAY, Color.red); ui.SetButton(delegate { GotoWebBrowser(MOM_APP_URL_ANDROID); }); new UIElementBorder(ui, Color.red); } else { // install and locate button for other systems ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() / 2) - 13, offset + 3.2f, 12, 1.3f); ui.SetText(CONTENT_INSTALL_VIA_STEAM, Color.red); ui.SetButton(delegate { GotoWebBrowser(MOM_APP_URL_STEAM); }); new UIElementBorder(ui, Color.red); ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() / 2) + 1, offset + 3.2f, 12, 1.3f); ui.SetText(CONTENT_LOCATE, Color.red); ui.SetButton(delegate { Import("MoM", true); }); new UIElementBorder(ui, Color.red); } } #if IA // Draw IA button startColor = Color.white; if (fcIA.NeedImport()) { startColor = Color.gray; } // Always disabled startColor = Color.gray; ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() - 30) / 2, 21, 30, 3); ui.SetText(IA_NAME, startColor); ui.SetFontSize(UIScaler.GetMediumFont()); //ui.SetButton(delegate { IA(); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui, startColor); // Draw IA import button ui = new UIElement(); if (fcIA.ImportAvailable()) { ui.SetLocation((UIScaler.GetWidthUnits() - 14) / 2, 24.2f, 14, 2); StringKey keyText = fcIA.NeedImport() ? CONTENT_IMPORT : CONTENT_REIMPORT; ui.SetText(keyText); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { Import("IA"); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui); } else // Import unavailable { ui.SetLocation((UIScaler.GetWidthUnits() - 24) / 2, 24.2f, 24, 1); if (Application.platform == RuntimePlatform.Android) { ui.SetText(IA_APP_NOT_FOUND_ANDROID, Color.red); } else { ui.SetText(IA_APP_NOT_FOUND, Color.red); } new UIElementBorder(ui, Color.red); } #endif ui = new UIElement(); ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2); ui.SetText(CommonStringKeys.EXIT, Color.red); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(Exit); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui, Color.red); // will display a button if a new version is available VersionManager.GetLatestVersionAsync(CheckForNewValkyrieVersion); }
public void Draw() { // This will destroy all Destroyer.Destroy(); Game game = Game.Get(); game.gameType = new NoGameType(); // Get the current content for games if (Application.platform == RuntimePlatform.OSXPlayer) { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.MacOS, Game.AppData() + "/", Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.MacOS, Game.AppData() + "/", Application.isEditor); } else if (Application.platform == RuntimePlatform.Android) { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.Android, Game.AppData() + "/", Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.Android, Game.AppData() + "/", Application.isEditor); } else { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.Windows, Game.AppData() + "/", Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.Windows, Game.AppData() + "/", Application.isEditor); } fcD2E.Inspect(); fcMoM.Inspect(); // Banner Image Sprite bannerSprite; Texture2D newTex = Resources.Load("sprites/banner") as Texture2D; GameObject banner = new GameObject("banner"); banner.tag = Game.DIALOG; banner.transform.SetParent(game.uICanvas.transform); RectTransform trans = banner.AddComponent <RectTransform>(); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 1 * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, (UIScaler.GetWidthUnits() - 18f) * UIScaler.GetPixelsPerUnit() / 2f, 18f * UIScaler.GetPixelsPerUnit()); banner.AddComponent <CanvasRenderer>(); UnityEngine.UI.Image image = banner.AddComponent <UnityEngine.UI.Image>(); bannerSprite = Sprite.Create(newTex, new Rect(0, 0, newTex.width, newTex.height), Vector2.zero, 1); image.sprite = bannerSprite; image.rectTransform.sizeDelta = new Vector2(18f * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); Color startColor = Color.white; // If we need to import we can't play this type if (fcD2E.NeedImport()) { startColor = Color.gray; } // Draw D2E button UIElement ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() - 30) / 2, 10, 30, 4); ui.SetText(D2E_NAME, startColor); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { D2E(); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui, startColor); // Draw D2E import button ui = new UIElement(); if (fcD2E.ImportAvailable()) { ui.SetLocation((UIScaler.GetWidthUnits() - 14) / 2, 14.2f, 14, 2); StringKey keyText = fcD2E.NeedImport() ? CONTENT_IMPORT : CONTENT_REIMPORT; ui.SetText(keyText); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { Import("D2E"); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui); } else // Import unavailable { ui.SetLocation((UIScaler.GetWidthUnits() - 24) / 2, 14.2f, 24, 1); ui.SetText(D2E_APP_NOT_FOUND, Color.red); new UIElementBorder(ui, Color.red); } // Draw MoM button startColor = Color.white; if (fcMoM.NeedImport()) { startColor = Color.gray; } ui = new UIElement(); ui.SetLocation((UIScaler.GetWidthUnits() - 30) / 2, 19, 30, 4); ui.SetText(MOM_NAME, startColor); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { MoM(); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui, startColor); // Draw MoM import button ui = new UIElement(); if (fcMoM.ImportAvailable()) { ui.SetLocation((UIScaler.GetWidthUnits() - 14) / 2, 23.2f, 14, 2); StringKey keyText = fcMoM.NeedImport() ? CONTENT_IMPORT : CONTENT_REIMPORT; ui.SetText(keyText); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(delegate { Import("MoM"); }); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui); } else // Import unavailable { ui.SetLocation((UIScaler.GetWidthUnits() - 24) / 2, 23.2f, 24, 1); ui.SetText(MOM_APP_NOT_FOUND, Color.red); new UIElementBorder(ui, Color.red); } ui = new UIElement(); ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2); ui.SetText(CommonStringKeys.EXIT, Color.red); ui.SetFontSize(UIScaler.GetMediumFont()); ui.SetButton(Exit); ui.SetBGColor(new Color(0, 0.03f, 0f)); new UIElementBorder(ui, Color.red); }
public void Draw() { // This will destroy all Destroyer.Destroy(); Game game = Game.Get(); game.gameType = new NoGameType(); // Get the current content for games if (Application.platform == RuntimePlatform.OSXPlayer) { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.MacOS, ContentData.ContentPath(), Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.MacOS, ContentData.ContentPath(), Application.isEditor); } else { fcD2E = new FFGImport(FFGAppImport.GameType.D2E, Platform.Windows, ContentData.ContentPath(), Application.isEditor); fcMoM = new FFGImport(FFGAppImport.GameType.MoM, Platform.Windows, ContentData.ContentPath(), Application.isEditor); } fcD2E.Inspect(); fcMoM.Inspect(); // Banner Image Sprite bannerSprite; Texture2D newTex = Resources.Load("sprites/banner") as Texture2D; GameObject banner = new GameObject("banner"); banner.tag = Game.DIALOG; banner.transform.SetParent(game.uICanvas.transform); RectTransform trans = banner.AddComponent <RectTransform>(); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 1 * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, (UIScaler.GetWidthUnits() - 18f) * UIScaler.GetPixelsPerUnit() / 2f, 18f * UIScaler.GetPixelsPerUnit()); banner.AddComponent <CanvasRenderer>(); UnityEngine.UI.Image image = banner.AddComponent <UnityEngine.UI.Image>(); bannerSprite = Sprite.Create(newTex, new Rect(0, 0, newTex.width, newTex.height), Vector2.zero, 1); image.sprite = bannerSprite; image.rectTransform.sizeDelta = new Vector2(18f * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); DialogBox db; Color startColor = Color.white; // If we need to import we can't play this type if (fcD2E.NeedImport()) { startColor = Color.gray; } // Draw D2E button TextButton tb = new TextButton( new Vector2((UIScaler.GetWidthUnits() - 30) / 2, 10), new Vector2(30, 4f), D2E_NAME, delegate { D2E(); }, startColor); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); // Draw D2E import button if (fcD2E.ImportAvailable()) { StringKey keyText = fcD2E.NeedImport() ? CONTENT_IMPORT : CONTENT_REIMPORT; tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 14.2f), new Vector2(10, 2f), keyText, delegate { Import("D2E"); }); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); } else // Import unavailable { db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 24) / 2, 14.2f), new Vector2(24, 1f), D2E_APP_NOT_FOUND, Color.red); db.AddBorder(); } // Draw MoM button startColor = Color.white; if (fcMoM.NeedImport()) { startColor = Color.gray; } tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 30) / 2, 19), new Vector2(30, 4f), MOM_NAME, delegate { MoM(); }, startColor); tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); // Draw MoM import button if (fcMoM.ImportAvailable()) { StringKey keyText = fcMoM.NeedImport() ? CONTENT_IMPORT : CONTENT_REIMPORT; tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 23.2f), new Vector2(10, 2f), keyText, delegate { Import("MoM"); }); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); } else // Import unavailable { db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 24) / 2, 23.2f), new Vector2(24, 1f), MOM_APP_NOT_FOUND, Color.red); db.AddBorder(); } new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), CommonStringKeys.EXIT, delegate { Exit(); }, Color.red); }