/// <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>
    /// 共通設定複寫
    /// </summary>
    private void OverrideSetCommon()
    {
        // Names
        PlayerSettings.companyName = mShowSetInfo.CompanyName;
        PlayerSettings.productName = mShowSetInfo.ProductName;
        // Orientation
        PlayerSettings.defaultInterfaceOrientation           = mShowSetInfo.UIOrientation;
        PlayerSettings.useAnimatedAutorotation               = mShowSetInfo.UseAnimAutor;
        PlayerSettings.allowedAutorotateToPortrait           = mShowSetInfo.OrienRoatable[0];
        PlayerSettings.allowedAutorotateToPortraitUpsideDown = mShowSetInfo.OrienRoatable[1];
        PlayerSettings.allowedAutorotateToLandscapeLeft      = mShowSetInfo.OrienRoatable[2];
        PlayerSettings.allowedAutorotateToLandscapeRight     = mShowSetInfo.OrienRoatable[3];
        // Identification

        /*
         * PlayerSettings.applicationIdentifier 是取得當下Platform的BundleIdentifier
         * 要取得特定Platform的Identifier
         * 要改用PlayerSettings.GetApplicationIdentifier(取得)和PlayerSettings.SetApplicationIdentifier(設置)
         */
        PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Standalone, mShowSetInfo.BundleIDStandalone);
        PlayerSettings.bundleVersion = mShowSetInfo.BundleVer;
        // Scripting Define Symbols
        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, mShowSetInfo.ScriptDefineSymblos);
        // Icon
        if (mShowSetInfo.IconSetStatus)
        {
            SDDataMove.SetIconsGroup(BuildTargetGroup.Unknown, mShowSetInfo.DefIcons);
        }
        // ---------------------------------------------------------------
    }
    /// <summary>
    /// 執行產生一個新的檔案
    /// </summary>
    private void DoCreate()
    {
        if (string.IsNullOrEmpty(ShowSetInfo.SettingName))
        {
            mIsEmptyFileName = true;
            mInfoBoxShow     = "需要檔案名稱";
            return;
        }

        if (CheckFileNameRepeat(false))         // 確認有沒有重複名稱
        {
            mIsEmptyFileName = true;
            mInfoBoxShow     = "檔案名稱與現有檔案重複";
            return;
        }

        SDDataMove.SaveData(ShowSetInfo);        // 存檔
        // Reset Status
        if (mIsEmptyFileName)
        {
            mIsEmptyFileName = false;
        }

        Close();
    }
    /// <summary>
    /// 讀取自設設定檔來複寫PlayerSetting
    /// </summary>
    public static void OverridePlayerSet(string iSDFileName)
    {
        Self.mShowSetInfo = SDDataMove.LoadData(iSDFileName);
        if (Self.mShowSetInfo == null)
        {
            Debug.Log("沒有找到設定檔案");
            return;
        }
        // Common
        Self.OverrideSetCommon();
        // Other
        switch (Self.mShowSetInfo.DefineTarget)
        {
        case eSDTarget.Android:
            Self.CheckDefineSymbols(Self.mShowSetInfo.ScriptDefineSymblos, ref Self.mShowSetInfo.AndroidSet.ScriptDefineSymblos);
            Self.OverrideSetAndroid();
            break;

        case eSDTarget.IOS:
            Self.CheckDefineSymbols(Self.mShowSetInfo.ScriptDefineSymblos, ref Self.mShowSetInfo.IOSSet.ScriptDefineSymblos);
            Self.OverrideSetIOS();
            break;
        }
        Debug.Log("資料設定完畢");
        AssetDatabase.Refresh();
    }
    /// <summary>
    /// 預設IOS資料(取現在的PlayerSetting)
    /// </summary>
    private void DefaultSetIOS()
    {
        SDIOSSet aTmpSet = new SDIOSSet();

        // Resolution and Presentation
        aTmpSet.RequiresFullScreen             = PlayerSettings.iOS.requiresFullScreen;
        aTmpSet.StatusBarHidden                = PlayerSettings.statusBarHidden;
        aTmpSet.StatusBarStyle                 = PlayerSettings.iOS.statusBarStyle;
        aTmpSet.ShowActivityIndicatorOnLoading = PlayerSettings.iOS.showActivityIndicatorOnLoading;
        // Debugging and crash reporting
        aTmpSet.ActionOnDotNetUnhandledException = PlayerSettings.actionOnDotNetUnhandledException;
        aTmpSet.LogObjCUncaughtExceptions        = PlayerSettings.logObjCUncaughtExceptions;
        aTmpSet.EnableCrashReportAPI             = PlayerSettings.enableCrashReportAPI;
        // Identification
        aTmpSet.BundleIDIOS = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.iOS);
        aTmpSet.BuildNumber = PlayerSettings.iOS.buildNumber;
        aTmpSet.AppleEnableAutomaticSigning = PlayerSettings.iOS.appleEnableAutomaticSigning;
        aTmpSet.AppleDeveloperTeamID        = PlayerSettings.iOS.appleDeveloperTeamID;
        aTmpSet.ProvisioningProfileID       = PlayerSettings.iOS.iOSManualProvisioningProfileID;
        // Configuration
        aTmpSet.ScriptingBackend        = PlayerSettings.GetScriptingBackend(BuildTargetGroup.iOS);
        aTmpSet.ApiCompatibilityLevel   = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.iOS);
        aTmpSet.TargetDevice            = PlayerSettings.iOS.targetDevice;
        aTmpSet.SDKVersion              = PlayerSettings.iOS.sdkVersion;
        aTmpSet.TargetOSVersionString   = PlayerSettings.iOS.targetOSVersionString;
        aTmpSet.PrepareIOSForRecording  = SDDataMove.GetBoolPlayerSetting("Prepare IOS For Recording");
        aTmpSet.RequiresPersistentWiFi  = PlayerSettings.iOS.requiresPersistentWiFi;
        aTmpSet.AppInBackgroundBehavior = PlayerSettings.iOS.appInBackgroundBehavior;
        aTmpSet.Architecture            = PlayerSettings.GetArchitecture(BuildTargetGroup.iOS);
        // Optimization
        aTmpSet.ScriptCallOptimizationLevel = PlayerSettings.iOS.scriptCallOptimization;
        aTmpSet.StripEngineCode             = PlayerSettings.stripEngineCode;
        aTmpSet.StripLevel = PlayerSettings.strippingLevel;
        // Scripting Define Symbols
        aTmpSet.ScriptDefineSymblos = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS);
        // Icon
        aTmpSet.IconOverride = true;
        SDDataMove.GetIconsGroup(BuildTargetGroup.iOS, ref mUIUseImages.IosIcons, ref aTmpSet.DefIcons);
        aTmpSet.PrerenderedIcon = PlayerSettings.iOS.prerenderedIcon;
        // Splash Images
        int aEmumTotal = Enum.GetNames(typeof(eMobileSplashScreen)).Length;

        mUIUseImages.IOSSplashImages = new Texture2D[aEmumTotal];
        aTmpSet.SplashImages         = new string[aEmumTotal];
        for (int i = 0; i < aEmumTotal; i++)
        {
            aTmpSet.SplashImages[i] = SDDataMove.GetSplashScreenPath((eMobileSplashScreen)i, ref mUIUseImages.IOSSplashImages[i]);
        }
        //-------------------------------------------------
        // Unity5 New
        aTmpSet.GraphicsType = PlayerSettings.GetGraphicsAPIs(BuildTarget.iOS);
        // Set Down
        mShowSetInfo.IOSSet = aTmpSet;
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 初始化
    /// </summary>
    private void SettingInit()
    {
        if (mInitStatus)
        {
            return;
        }

        mChangeInfoList = SFGetCustom.GetBaseTypeList();
        mDefineShowPop  = SDDataMove.GetSaveDataNames();
        mXCodeWriteList = SXGetCustom.GetBaseTypeList();

        mInitStatus = true;
    }
    /// <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>
    /// 預設Android資料(取現在的PlayerSetting)
    /// </summary>
    private void DefaultSetAndroid()
    {
        SDAndroidSet aTmpSet = new SDAndroidSet();

        // Resolution and Presentation
        aTmpSet.Use32BitDisplayBuffer          = PlayerSettings.use32BitDisplayBuffer;
        aTmpSet.disableDepthAndStencilBuffers  = PlayerSettings.Android.disableDepthAndStencilBuffers;
        aTmpSet.ShowActivityIndicatorOnLoading = PlayerSettings.Android.showActivityIndicatorOnLoading;
        // Identification
        aTmpSet.BundleIDAndroid = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
        aTmpSet.BundleCode      = PlayerSettings.Android.bundleVersionCode;
        aTmpSet.SdkVersions     = PlayerSettings.Android.minSdkVersion;
        // Configuration
        aTmpSet.TargetDevice          = PlayerSettings.Android.targetDevice;
        aTmpSet.ApiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Android);
        aTmpSet.ForceInternet         = PlayerSettings.Android.forceInternetPermission;
        aTmpSet.ForceSDCard           = PlayerSettings.Android.forceSDCardPermission;
        // Publishing Settings
        // PlayerSettings 的keystoreName是完整的Keystore路徑
        // 撰寫工具上我希望盡可能簡單的把檔案都放在Assets裡面
        // 所以在取路徑的時候檢查拿掉專案Assets之前的路徑
        string aKeyStorePath = PlayerSettings.Android.keystoreName;
        int    aCheckNum     = aKeyStorePath.IndexOf("Assets", System.StringComparison.OrdinalIgnoreCase);

        if (aCheckNum > 0)
        {
            aKeyStorePath = aKeyStorePath.Remove(0, Application.dataPath.Length + 1);
        }

        aTmpSet.KeyStorePath      = aKeyStorePath;
        aTmpSet.KeyStorePassword  = PlayerSettings.Android.keystorePass;
        aTmpSet.KeyAlialsName     = PlayerSettings.Android.keyaliasName;
        aTmpSet.KeyAlialsPassword = PlayerSettings.Android.keyaliasPass;
        // Scripting Define Symbols
        aTmpSet.ScriptDefineSymblos = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android);
        // Icon
        aTmpSet.IconOverride = true;
        SDDataMove.GetIconsGroup(BuildTargetGroup.Android, ref mUIUseImages.AndroidIcons, ref aTmpSet.DefIcons);
        // Splash Images
        aTmpSet.SplashImage       = SDDataMove.GetSplashScreenPath("androidSplashScreen", ref mUIUseImages.AndroidSplashImage);
        aTmpSet.SplashScreenScale = PlayerSettings.Android.splashScreenScale;
        //-------------------------------------------------
        // Unity5 New
        aTmpSet.GraphicsType = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android);
        // Set Down
        mShowSetInfo.AndroidSet = aTmpSet;
    }
    /// <summary>
    /// Android設定複寫
    /// </summary>
    private void OverrideSetAndroid()
    {
        SDAndroidSet aTmpSet = mShowSetInfo.AndroidSet;

        // Resolution and Presentation
        PlayerSettings.use32BitDisplayBuffer = aTmpSet.Use32BitDisplayBuffer;
        PlayerSettings.Android.disableDepthAndStencilBuffers  = aTmpSet.disableDepthAndStencilBuffers;
        PlayerSettings.Android.showActivityIndicatorOnLoading = aTmpSet.ShowActivityIndicatorOnLoading;
        // Identification
        PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, aTmpSet.BundleIDAndroid);
        PlayerSettings.Android.bundleVersionCode = aTmpSet.BundleCode;
        PlayerSettings.Android.minSdkVersion     = aTmpSet.SdkVersions;
        // Configuration
        PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Android, aTmpSet.ApiCompatibilityLevel);
        PlayerSettings.Android.forceInternetPermission = aTmpSet.ForceInternet;
        PlayerSettings.Android.forceSDCardPermission   = aTmpSet.ForceSDCard;
        PlayerSettings.Android.targetDevice            = aTmpSet.TargetDevice;
        // Publishing Settings
        PlayerSettings.Android.keystoreName = string.Format("{0}/{1}", Application.dataPath, aTmpSet.KeyStorePath);
        PlayerSettings.Android.keystorePass = aTmpSet.KeyStorePassword;
        PlayerSettings.Android.keyaliasName = aTmpSet.KeyAlialsName;
        PlayerSettings.Android.keyaliasPass = aTmpSet.KeyAlialsPassword;
        // Scripting Define Symbols
        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, aTmpSet.ScriptDefineSymblos);
        // Icon
        if (aTmpSet.IconSetStatus)
        {
            if (aTmpSet.IconOverride)
            {
                SDDataMove.SetIconsGroup(BuildTargetGroup.Android, aTmpSet.DefIcons);
            }
            else
            {
                SDDataMove.ClearnIconsGroup(BuildTargetGroup.Android);
            }
        }
        // Splash Image
        if (aTmpSet.SplashSetStatus)
        {
            SDDataMove.SetSplashScreen("androidSplashScreen", mShowSetInfo.AndroidSet.SplashImage);
            PlayerSettings.Android.splashScreenScale = aTmpSet.SplashScreenScale;
        }
        //----------------------------------------
        // Unity5 New
        PlayerSettings.SetGraphicsAPIs(BuildTarget.Android, aTmpSet.GraphicsType);
    }
Ejemplo n.º 10
0
    /// <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);
        }
    }
Ejemplo n.º 11
0
    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>
    /// IOS設定複寫
    /// </summary>
    private void OverrideSetIOS()
    {
        SDIOSSet aTmpSet = mShowSetInfo.IOSSet;

        // Resolution and Presentation
        PlayerSettings.iOS.requiresFullScreen             = aTmpSet.RequiresFullScreen;
        PlayerSettings.statusBarHidden                    = aTmpSet.StatusBarHidden;
        PlayerSettings.iOS.statusBarStyle                 = aTmpSet.StatusBarStyle;
        PlayerSettings.iOS.showActivityIndicatorOnLoading = aTmpSet.ShowActivityIndicatorOnLoading;
        // Debugging and crash reporting
        PlayerSettings.actionOnDotNetUnhandledException = aTmpSet.ActionOnDotNetUnhandledException;
        PlayerSettings.logObjCUncaughtExceptions        = aTmpSet.LogObjCUncaughtExceptions;
        PlayerSettings.enableCrashReportAPI             = aTmpSet.EnableCrashReportAPI;
        // Identification
        PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, aTmpSet.BundleIDIOS);
        PlayerSettings.iOS.buildNumber = aTmpSet.BuildNumber;
        PlayerSettings.iOS.appleEnableAutomaticSigning    = aTmpSet.AppleEnableAutomaticSigning;
        PlayerSettings.iOS.appleDeveloperTeamID           = aTmpSet.AppleDeveloperTeamID;
        PlayerSettings.iOS.iOSManualProvisioningProfileID = aTmpSet.ProvisioningProfileID;
        // Configuration
        PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, aTmpSet.ScriptingBackend);
        PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.iOS, aTmpSet.ApiCompatibilityLevel);
        PlayerSettings.iOS.targetDevice          = aTmpSet.TargetDevice;
        PlayerSettings.iOS.sdkVersion            = aTmpSet.SDKVersion;
        PlayerSettings.iOS.targetOSVersionString = aTmpSet.TargetOSVersionString;
        SDDataMove.SetBoolPalyerSetting("Prepare IOS For Recording", aTmpSet.PrepareIOSForRecording);
        PlayerSettings.iOS.requiresPersistentWiFi  = aTmpSet.RequiresPersistentWiFi;
        PlayerSettings.iOS.appInBackgroundBehavior = aTmpSet.AppInBackgroundBehavior;
        if (mShowSetInfo.IOSSet.ScriptingBackend == ScriptingImplementation.IL2CPP &&
            mShowSetInfo.IOSSet.SDKVersion == iOSSdkVersion.DeviceSDK)
        {
            PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, aTmpSet.Architecture);
        }
        // Optimization
        PlayerSettings.iOS.scriptCallOptimization = aTmpSet.ScriptCallOptimizationLevel;
        if (aTmpSet.ScriptingBackend == ScriptingImplementation.IL2CPP)
        {
            PlayerSettings.stripEngineCode = aTmpSet.StripEngineCode;
        }
        else if (aTmpSet.ScriptingBackend == ScriptingImplementation.Mono2x)
        {
            PlayerSettings.strippingLevel = aTmpSet.StripLevel;
        }
        // Scripting Define Symbols
        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, aTmpSet.ScriptDefineSymblos);
        // Icon
        if (aTmpSet.IconSetStatus)
        {
            if (aTmpSet.IconOverride)
            {
                SDDataMove.SetIconsGroup(BuildTargetGroup.iOS, aTmpSet.DefIcons);
            }
            else
            {
                SDDataMove.ClearnIconsGroup(BuildTargetGroup.iOS);
            }
        }
        PlayerSettings.iOS.prerenderedIcon = aTmpSet.PrerenderedIcon;
        // Splash
        if (aTmpSet.SplashSetStatus)
        {
            for (int i = 0; i < mShowSetInfo.IOSSet.SplashImages.Length; i++)
            {
                SDDataMove.SetSplashScreen((eMobileSplashScreen)i, mShowSetInfo.IOSSet.SplashImages[i]);
            }
        }
        //----------------------------------------
        // Unity5 New
        PlayerSettings.SetGraphicsAPIs(BuildTarget.iOS, aTmpSet.GraphicsType);
    }
    /// <summary>
    /// 修改存檔
    /// </summary>
    private void DoRevise()
    {
        SDDataMove.SaveData(ShowSetInfo);

        Close();
    }