/// <summary> /// 預設共通資料(取現在的PlayerSetting) /// PC版的BuildTargetGroup是Standalone /// Unknown是PlayerSetting上面那區 /// 因為Icon設定沒有打算設定PC版 /// 所以只弄預設區塊 /// </summary> private void DefaultSetCommon() { mShowSetInfo = new SDefineSet(); // Names mShowSetInfo.CompanyName = PlayerSettings.companyName; mShowSetInfo.ProductName = PlayerSettings.productName; // Orientation mShowSetInfo.UIOrientation = PlayerSettings.defaultInterfaceOrientation; mShowSetInfo.UseAnimAutor = PlayerSettings.useAnimatedAutorotation; mShowSetInfo.OrienRoatable = new bool[4]; mShowSetInfo.OrienRoatable[0] = PlayerSettings.allowedAutorotateToPortrait; mShowSetInfo.OrienRoatable[1] = PlayerSettings.allowedAutorotateToPortraitUpsideDown; mShowSetInfo.OrienRoatable[2] = PlayerSettings.allowedAutorotateToLandscapeLeft; mShowSetInfo.OrienRoatable[3] = PlayerSettings.allowedAutorotateToLandscapeRight; // Identification /* * PlayerSettings.applicationIdentifier 是取得當下Platform的BundleIdentifier * 要取得特定Platform的Identifier * 要改用PlayerSettings.GetApplicationIdentifier(取得)和PlayerSettings.SetApplicationIdentifier(設置) */ mShowSetInfo.BundleIDStandalone = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Standalone); mShowSetInfo.BundleVer = PlayerSettings.bundleVersion; // Scripting Define Symbols mShowSetInfo.ScriptDefineSymblos = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone); // Icon SDDataMove.GetIconsGroup(BuildTargetGroup.Unknown, ref mUIUseImages.DefaultIcon, ref mShowSetInfo.DefIcons); // Default Icon // --------------------------------------------------------------- }
/// <summary> /// 讀取Icon圖 /// </summary> public static Texture2D[] LoadIconTexture(eSettingPage iPage, ref SDefineSet iSetting) { string[] aSelectIcons = null; Texture2D[] aResultTexture = null; BuildTargetGroup iPSet = BuildTargetGroup.Unknown; switch (iPage) { case eSettingPage.android: aSelectIcons = iSetting.AndroidSet.DefIcons; iPSet = BuildTargetGroup.Android; break; case eSettingPage.ios: aSelectIcons = iSetting.IOSSet.DefIcons; iPSet = BuildTargetGroup.iOS; break; default: aSelectIcons = iSetting.DefIcons; break; } if (CheckImagePathIsEmpty(aSelectIcons)) { GetIconsGroup(iPSet, ref aResultTexture, ref aSelectIcons); return(aResultTexture); } try { aResultTexture = new Texture2D[aSelectIcons.Length]; for (int i = 0; i < aSelectIcons.Length; i++) { if (string.IsNullOrEmpty(aSelectIcons[i])) { continue; } Texture2D aTmpIcon = (Texture2D)AssetDatabase.LoadAssetAtPath(aSelectIcons[i], typeof(System.Object)); aResultTexture[i] = aTmpIcon; } Debug.Log("GetFinish."); return(aResultTexture); } catch (Exception e) { Debug.LogError("Load Icon temp data error:\n" + e.Message); return(aResultTexture); } }
/// <summary> /// 顯示現有存檔的設定訊息 /// </summary> private void SetShowSettingInfo() { SDefineSet aShowInfo = SDDataMove.LoadData(FileNameArray[mFileShowIndex]); ShowImageGroup aImageG = new ShowImageGroup(); // Icon aImageG.DefaultIcon = SDDataMove.LoadIconTexture(eSettingPage.common, ref aShowInfo); aImageG.AndroidIcons = SDDataMove.LoadIconTexture(eSettingPage.android, ref aShowInfo); aImageG.IosIcons = SDDataMove.LoadIconTexture(eSettingPage.ios, ref aShowInfo); // Splash Image aImageG.IOSSplashImages = SDDataMove.LoadIOSSplashTexture(ref aShowInfo); aImageG.AndroidSplashImage = SDDataMove.LoadAndroidSplashTexture(ref aShowInfo); // SetData SetDefineData(aShowInfo, aImageG); }
/// <summary> /// 依照檔案名稱尋找並讀取檔案 /// </summary> public static SDefineSet LoadData(string iFileName) { string aSavePath = GetSaveFullPath(); try { string aLoadedJson = SFileIOModfied.LoadFromJsonFile(aSavePath, iFileName); SDefineSet aResult = JsonConvert.DeserializeObject <SDefineSet>(aLoadedJson); Debug.Log("LoadFinish."); return(aResult); } catch (Exception e) { Debug.LogError("Load temp data error:\n" + e.Message); return(new SDefineSet()); } }
/// <summary> /// 儲存檔案 /// </summary> public static void SaveData(SDefineSet iSetData) { string aSavePath = GetSaveFullPath(); try { string aJsonString = JsonConvert.SerializeObject(iSetData, Formatting.Indented); Debug.Log("TestSave cahge to Json string\n" + aJsonString); SFileIOModfied.SaveNewJsonFile(aSavePath, iSetData.SettingName, aJsonString); AssetDatabase.Refresh(); EditorUtility.DisplayDialog("成功", "資料建置完畢", "確定"); } catch (Exception e) { Debug.LogError("Save temp data error:\n" + e.Message); } }
/// <summary> /// 讀取Splash圖示 /// </summary> public static Texture2D[] LoadIOSSplashTexture(ref SDefineSet iSetting) { string[] aSelectSplashs = iSetting.IOSSet.SplashImages; Texture2D[] aResultTexture = null; if (CheckImagePathIsEmpty(aSelectSplashs)) { int aEmumTotal = Enum.GetNames(typeof(eMobileSplashScreen)).Length; aResultTexture = new Texture2D[aEmumTotal]; aSelectSplashs = new string[aEmumTotal]; for (int i = 0; i < aEmumTotal; i++) { aSelectSplashs[i] = SDDataMove.GetSplashScreenPath((eMobileSplashScreen)i, ref aResultTexture[i]); } iSetting.IOSSet.SplashImages = aSelectSplashs; return(aResultTexture); } try { aResultTexture = new Texture2D[aSelectSplashs.Length]; for (int i = 0; i < aSelectSplashs.Length; i++) { if (string.IsNullOrEmpty(aSelectSplashs[i])) { continue; } Texture2D aTmpSplash = (Texture2D)AssetDatabase.LoadAssetAtPath(aSelectSplashs[i], typeof(System.Object)); aResultTexture[i] = aTmpSplash; } Debug.Log("GetFinish."); iSetting.IOSSet.SplashImages = aSelectSplashs; return(aResultTexture); } catch (Exception e) { Debug.LogError("Load Icon temp data error:\n" + e.Message); return(aResultTexture); } }
public static Texture2D LoadAndroidSplashTexture(ref SDefineSet iSetting) { string[] aSelectSplashs = new string[1]; aSelectSplashs[0] = iSetting.AndroidSet.SplashImage; Texture2D aResultTexture = null; if (CheckImagePathIsEmpty(aSelectSplashs)) { aSelectSplashs = new string[1]; aSelectSplashs[0] = SDDataMove.GetSplashScreenPath("androidSplashScreen", ref aResultTexture); iSetting.AndroidSet.SplashImage = aSelectSplashs[0]; return(aResultTexture); } try { for (int i = 0; i < aSelectSplashs.Length; i++) { if (string.IsNullOrEmpty(aSelectSplashs[i])) { continue; } Texture2D aTmpSplash = (Texture2D)AssetDatabase.LoadAssetAtPath(aSelectSplashs[i], typeof(System.Object)); aResultTexture = aTmpSplash; } Debug.Log("GetFinish."); iSetting.AndroidSet.SplashImage = aSelectSplashs[0]; return(aResultTexture); } catch (Exception e) { Debug.LogError("Load Icon temp data error:\n" + e.Message); return(aResultTexture); } }
/// <summary> /// 設定Define資料 /// </summary> public void SetDefineData(SDefineSet iInfoData, ShowImageGroup iImageG) { mShowSetInfo = iInfoData; mUIUseImages = iImageG; }