/// <summary>
        /// Overrides the postprocess method to revert the AndroidProductInfo changes to the PlayerSettings.
        /// <summary>
        override public void Postprocess(string buildPath)
        {
            base.Postprocess(buildPath);

            AndroidProductInfo info;

            info = PlatformUtil.GetSettings <AndroidProductInfo>();

            if (info)
            {
                // restore player settings
                PlayerSettings.productName = this.ProductName;
                PlayerSettings.SetApplicationIdentifier(BuildTargetGroup, this.BundleIdentifier);
                PlayerSettings.bundleVersion             = this.BundleVersion;
                PlayerSettings.Android.bundleVersionCode = this.BundleVersionCode;
                PlayerSettings.Android.minSdkVersion     = this.SdkVersion;

                // clear player settings
                this.ProductName       = null;
                this.BundleIdentifier  = null;
                this.BundleVersion     = null;
                this.BundleVersionCode = 0;
                this.SdkVersion        = default(AndroidSdkVersions);
            }
        }
        void OnGUI()
        {
            if (SceneNavigator.Instance && SceneNavigator.Instance.IsReady)
            {
                GUIStyle style;
                style                  = new GUIStyle(GUI.skin.label);
                style.alignment        = TextAnchor.MiddleCenter;
                style.fontSize         = 18;
                style.normal.textColor = new Color(0f, 0f, 0f, 0.5f);

                Rect rect;
                rect = new Rect(0, 0, Screen.width, Screen.height);

                ProductInfo info;
                info = PlatformUtil.GetSettings <ProductInfo>();

                string name;
                name = info ? info.DisplayName : "this app";

                string text;
                text = string.Format("This version of {0} has been created specifically for demonstration purposes.", name);

                GUILayout.BeginArea(rect);
                GUILayout.BeginVertical();
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.Label(text, style, GUILayout.Width(Screen.width), GUILayout.Height(rect.height * 0.2f));
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                GUILayout.EndArea();
            }
        }
예제 #3
0
 public static void ReadGameVersionInfo()
 {
     if (Util.HasKey("dhh_version"))
     {
         string   @string = Util.GetString("dhh_version");
         string[] array   = @string.Split(new char[]
         {
             '|'
         });
         if (array.Length >= 2)
         {
             int num            = Convert.ToInt32(array[0]);
             int appVersionCode = PlatformUtil.GetInstance().GetAppVersionCode();
             AppConst.GameVerCode = Mathf.Max(num, appVersionCode);
             if (appVersionCode > num)
             {
                 AppConst.GameVerName = PlatformUtil.GetInstance().GetAppVersionName();
             }
             else
             {
                 AppConst.GameVerName = array[1];
             }
         }
         else
         {
             AppConst.GameVerCode = PlatformUtil.GetInstance().GetAppVersionCode();
             AppConst.GameVerName = PlatformUtil.GetInstance().GetAppVersionName();
         }
     }
     else
     {
         AppConst.GameVerCode = PlatformUtil.GetInstance().GetAppVersionCode();
         AppConst.GameVerName = PlatformUtil.GetInstance().GetAppVersionName();
     }
 }
예제 #4
0
    private static int GetAudioDuration(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 3);
            PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       audioFile    = ToLua.CheckString(L, 2);
            LuaTypes     luaTypes     = LuaDLL.lua_type(L, 3);
            Action <int> completeCallback;
            if (luaTypes != LuaTypes.LUA_TFUNCTION)
            {
                completeCallback = (Action <int>)ToLua.CheckObject(L, 3, typeof(Action <int>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                completeCallback = (DelegateFactory.CreateDelegate(typeof(Action <int>), func) as Action <int>);
            }
            platformUtil.GetAudioDuration(audioFile, completeCallback);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #5
0
    public override void OnMessage(IMessage message)
    {
        string name = message.Name;
        object body = message.Body;
        string text = name;

        switch (text)
        {
        case "UpdateTipsContent":
            this.OnUpdateTipsContent(body.ToString());
            break;

        case "ExtractPackageFile":
            this.OnExtractPackageFile(body.ToString());
            break;

        case "UpdateDownloadProgress":
            this.OnDownloadProgress(body.ToString());
            break;

        case "UpdateCompleteEnterGame":
            if (Convert.ToBoolean(body))
            {
                this.txtVersion.text = string.Format("{0}_{1}_{2}", PlatformUtil.GetInstance().GetChannelId(), AppConst.GameVerName, AppConst.GameVerCode);
            }
            break;

        case "UpdateShowTips":
            this.OnShowUpdateTips(body);
            break;
        }
    }
예제 #6
0
        public static void OpenWebViewWithLocalFile(string filename, Rect viewRect, Action <bool> completeCallback)
        {
            string text = Util.DataPath + filename;

            if (Application.platform == RuntimePlatform.Android)
            {
                text = "file:///" + text;
            }
            PlatformUtil.GetInstance().OpenWebView(text, viewRect, completeCallback);
        }
예제 #7
0
    private void DoTest()
    {
        string pdPath = PlatformUtil.GetPersistentDataPath() + "/ResVer.txt";

        Debug.LogWarning("Exists:" + File.Exists(pdPath));
        if (!File.Exists(pdPath))
        {
            File.WriteAllText(pdPath, "txt", Encoding.UTF8);
        }
    }
예제 #8
0
        private void HandleDescriptionData(Data data)
        {
            dismissText.text = "- PRESS " + InputStringHelper.GetStringForInput(dismissInput) + " TO CONTINUE -";
            if (PlatformUtil.GetPlatform() == Platform.XBOX_ONE)
            {
                description.text = ParseDescription(data.Info.xboxDescription);
                return;
            }

            description.text = ParseDescription(data.Info.defaultPromptDescription);
        }
        public static string AssetBundleName2Url(string name)
        {
            var retUrl = FilePath.PersistentDataPath + "AssetBundles/" + PlatformUtil.GetPlatformName() + "/" + name;

            if (File.Exists(retUrl))
            {
                return(retUrl);
            }

            return(FilePath.StreamingAssetsPath + "AssetBundles/" + PlatformUtil.GetPlatformName() + "/" + name);
        }
        public static string AssetBundleUrl2Name(string url)
        {
            string retName = null;
            var    parren  = FilePath.StreamingAssetsPath + "AssetBundles/" + PlatformUtil.GetPlatformName() + "/";

            retName = url.Replace(parren, "");

            parren  = FilePath.PersistentDataPath + "AssetBundles/" + PlatformUtil.GetPlatformName() + "/";
            retName = retName.Replace(parren, "");
            return(retName);
        }
예제 #11
0
        public static void OnPreprocess(IBuildProcessor processor)
        {
            ProductInfo info;

            info = PlatformUtil.GetSettings <ProductInfo>();

            if (info)
            {
                ComputeAnalyticsNameOverride(info);
            }
        }
예제 #12
0
 public ResourceUpdate(ResourceManager resourceManager)
 {
     platform        = PlatformUtil.GetPlatformName();
     assetBundlePath = Application.persistentDataPath + "/" + platform;
     if (!Directory.Exists(assetBundlePath))
     {
         Directory.CreateDirectory(assetBundlePath);
     }
     this.resourceManager = resourceManager;
     localConfig          = new Dictionary <string, string>();
     newConfig            = new Dictionary <string, string>();
     updateFiles          = new List <string>();
 }
예제 #13
0
        public SteamUtilTest()
        {
            // Workaround for Mono related issue regarding System.Net.Http.
            // More detail: https://github.com/dotnet/corefx/issues/19914

            var systemNetHttpDll = new FileInfo(Path.Combine(Environment.CurrentDirectory, "System.Net.Http.dll"));

            if (systemNetHttpDll.Exists && !PlatformUtil.IsWindows())
            {
                systemNetHttpDll.Delete();
            }

            WebAPIKeyResolver.APIKey = Environment.GetEnvironmentVariable("TITAN_WEB_API_KEY");
        }
예제 #14
0
        /// <summary>
        /// Updates the info plist.
        /// </summary>
        protected virtual void PostprocessXcodePlist()
        {
            // read plist
            Dictionary <string, object> dict;

            dict = ReadPlist();

            // cleanup plist
            dict.Remove("CFBundleIconFiles");

            // remove default launch image entries from the plist -
            // otherwise we get a black launch screen.
            // without these values, launch uses our LaunchScreen.xib file (white screen)
            dict.Remove("UILaunchStoryboardName~ipad");
            dict.Remove("UILaunchStoryboardName~iphone");
            dict.Remove("UILaunchStoryboardName~ipod");

            // update plist
            dict["UIPrerenderedIcon"] = true;
            dict["CFBundleAllowMixedLocalizations"] = true;

            iOSProductInfo productInfo = PlatformUtil.GetSettings <iOSProductInfo>(SagoPlatform.PlatformUtil.ActivePlatform);
            object         urlScheme   = productInfo.UrlScheme;

            dict["CFBundleURLTypes"] = new List <object> {
                new Dictionary <string, object> {
                    { "CFBundleURLName", PlayerSettings.applicationIdentifier },
                    { "CFBundleURLSchemes", new List <object> {
                          urlScheme
                      } }
                }
            };

            dict["LSApplicationQueriesSchemes"] = iOSLSApplicationQueriesSchemes.Schemes;
            dict["CFBundleShortVersionString"]  = this.BundleShortVersion;
            dict["CFBundleVersion"]             = this.BundleVersion;
            dict["UILaunchStoryboardName"]      = "LaunchScreen";

            // Inform App Store submission/Testflight that we do not use any non-standard encryption.
            dict["ITSAppUsesNonExemptEncryption"] = false;

            dict["NSPhotoLibraryUsageDescription"] = "This app would like to save photos to your camera roll.";

            dict["LSHasLocalizedDisplayName"] = true;

            // write plist
            WritePlist(dict);
        }
예제 #15
0
    private static int OpenChannelCenter(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            platformUtil.OpenChannelCenter();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #16
0
    private static int GetInstance(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 0);
            PlatformUtil instance = PlatformUtil.GetInstance();
            ToLua.PushObject(L, instance);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #17
0
        public static void Open(string path)
        {
            var os = PlatformUtil.CurrentOs();

            if (os == PlatformUtil.OperatingSystem.Windows)
            {
                OpenInWin(path);
            }
            else if (os == PlatformUtil.OperatingSystem.MacOsx)
            {
                OpenInMac(path);
            }
            else
            {
                UnityEngine.Debug.LogWarning("Opening file browser not supported for OS: " + os);
            }
        }
예제 #18
0
        public SteamUtilTest()
        {
            // Workaround for Mono related issue regarding System.Net.Http.
            // More detail: https://github.com/dotnet/corefx/issues/19914

            var systemNetHttpDll = new FileInfo(Path.Combine(Environment.CurrentDirectory, "System.Net.Http.dll"));

            if (systemNetHttpDll.Exists && !PlatformUtil.IsWindows())
            {
                systemNetHttpDll.Delete();
            }

            if (!string.IsNullOrEmpty(EnvironmentKey))
            {
                _handle.SetKey(EnvironmentKey);
            }
        }
예제 #19
0
    private static int GetAppVersionCode(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil   = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            int          appVersionCode = platformUtil.GetAppVersionCode();
            LuaDLL.lua_pushinteger(L, appVersionCode);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #20
0
    private static int RegisterBatteryReceiver(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            LuaFunction  luaFunc      = ToLua.CheckLuaFunction(L, 2);
            platformUtil.RegisterBatteryReceiver(luaFunc);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #21
0
    private static int GetSimSerialNumber(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil    = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       simSerialNumber = platformUtil.GetSimSerialNumber();
            LuaDLL.lua_pushstring(L, simSerialNumber);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #22
0
    private static int GetDeviceTotalMemorySize(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil          = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       deviceTotalMemorySize = platformUtil.GetDeviceTotalMemorySize();
            LuaDLL.lua_pushstring(L, deviceTotalMemorySize);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #23
0
    private static int IsExistSDCard(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       str          = platformUtil.IsExistSDCard();
            LuaDLL.lua_pushstring(L, str);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #24
0
    private static int GetAvailableSDCardBlockSize(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil             = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       availableSDCardBlockSize = platformUtil.GetAvailableSDCardBlockSize();
            LuaDLL.lua_pushstring(L, availableSDCardBlockSize);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #25
0
    private static int HasChannelCenter(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            bool         value        = platformUtil.HasChannelCenter();
            LuaDLL.lua_pushboolean(L, value);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #26
0
    private static int GetLocalFileInfo(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil  = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       localFileInfo = platformUtil.GetLocalFileInfo();
            LuaDLL.lua_pushstring(L, localFileInfo);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #27
0
    private static int GetProvidersName(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            PlatformUtil platformUtil  = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       providersName = platformUtil.GetProvidersName();
            LuaDLL.lua_pushstring(L, providersName);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #28
0
    private static int SetLogoutListener(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            PlatformUtil platformUtil   = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            LuaFunction  logoutListener = ToLua.CheckLuaFunction(L, 2);
            platformUtil.SetLogoutListener(logoutListener);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #29
0
    private static int CallSdkEvent(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       jsonData     = ToLua.CheckString(L, 2);
            platformUtil.CallSdkEvent(jsonData);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #30
0
    private static int PlayAudio(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil));
            string       audioFile    = ToLua.CheckString(L, 2);
            platformUtil.PlayAudio(audioFile);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }