public void Init()
    {
        string text = Service.Get <ConditionalConfiguration>().Get("Unity.QualitySetting.property", "Mobile_Low");

        getDefaultGraphicsValues(text, out ClubPenguin.QualityLevel graphicsLevel, out ClubPenguin.QualityLevel lodPenguinQualityLevel, out int antiAlias, out bool cameraPost);
        QualityConditionalTier = new CacheableType <string>("cp.QualityConditionalTier", text);
        GraphicsLevel          = new CacheableType <ClubPenguin.QualityLevel>("cp.GraphicsLevel", graphicsLevel);
        LodPenguinQualityLevel = new CacheableType <ClubPenguin.QualityLevel>("cp.LodPenguinQualityLevel", lodPenguinQualityLevel);
        AntiAliasLevel         = new CacheableType <int>("cp.AntiAliasEnabled", antiAlias);
        CameraPostEnabled      = new CacheableType <bool>("cp.CameraPostenabled", cameraPost);
        GameSettings gameSettings = Service.Get <GameSettings>();

        gameSettings.RegisterSetting(QualityConditionalTier, canBeReset: true);
        gameSettings.RegisterSetting(GraphicsLevel, canBeReset: true);
        gameSettings.RegisterSetting(LodPenguinQualityLevel, canBeReset: true);
        gameSettings.RegisterSetting(AntiAliasLevel, canBeReset: true);
        gameSettings.RegisterSetting(CameraPostEnabled, canBeReset: true);
        SetAntialiasing(AntiAliasLevel);
        SetCameraPostEffects(CameraPostEnabled);
        SetLodPenguinQualityLevel(LodPenguinQualityLevel);
        SetFullscreen(Screen.fullScreen);
        SetAspectRatio((float)Screen.width / (float)Screen.height);
        if (AspectAlias == string.Empty)
        {
            SetAspectRatio(1.77777779f);
        }
    }
예제 #2
0
 public MockGameSettings()
 {
     SfxEnabled             = new CacheableType <bool>("cp.tests.SfxEnabled", defaultValue: true);
     MusicEnabled           = new CacheableType <bool>("cp.tests.MusicEnabled", defaultValue: true);
     SfxVolume              = new CacheableType <float>("cp.tests.SfxVolume", 1f);
     MusicVolume            = new CacheableType <float>("cp.tests.MusicVolume", 1f);
     SavedLanguage          = new CacheableType <string>("cp.tests.SavedLanguage", "en_US");
     DevelopmentEnvironment = new DevCacheableType <Disney.Kelowna.Common.Environment.Environment>("cp.tests.DevelopmentEnvironment", Disney.Kelowna.Common.Environment.Environment.QA);
 }
예제 #3
0
 public void CheckAndClearCache(string currentVersion)
 {
     lastClearedVersion = new CacheableType <string>("cp.ImageCache.ClearedVersion", "1.0");
     if (!currentVersion.Equals(lastClearedVersion.Value))
     {
         ClearImageCache();
         lastClearedVersion.Value = currentVersion;
     }
 }
예제 #4
0
        public static object Unpack(byte[] rawData)
        {
            if ((rawData == null) || (rawData.Length == 0))
            {
                return(null);
            }

            using (MemoryStream mem = new MemoryStream(rawData))
            {
                if (mem.ReadByte() == 0)
                {
                    CacheableType ct = (CacheableType)mem.ReadShort();

                    if (ct != CacheableType.Unsupported)
                    {
                        if (ct == CacheableType.Binary)
                        {
                            int binLength = mem.ReadInteger();

                            if (binLength > 0)
                            {
                                return(mem.ReadBytes(binLength));
                            }
                        }
                        else
                        {
                            Type type = ResolveStoredType(ct);

                            if (type != null)
                            {
                                object target = null;

                                try
                                {
                                    target = Activator.CreateInstance(type);
                                }
                                catch
                                {
                                    target = null;
                                }

                                if ((target != null) && (target is ICacheable))
                                {
                                    ((ICacheable)target).Restore(mem);

                                    return(target);
                                }
                            }
                        }
                    }
                }
            }

            return(null);
        }
예제 #5
0
 public void RemoveUsername(string username)
 {
     if (Usernames.Remove(username))
     {
         if (CurrentUsername == username)
         {
             CurrentUsername = string.Empty;
         }
         CacheableType <string> accountDataCache = getAccountDataCache(username);
         accountDataCache.SetValue(string.Empty);
         KeyChainCacheableString credentialDataCache = getCredentialDataCache(username);
         credentialDataCache.SetValue(string.Empty);
         saveUsernames();
     }
 }
예제 #6
0
        public RememberMeAccountData LoadAccountData(string username)
        {
            CacheableType <string> accountDataCache      = getAccountDataCache(username);
            RememberMeAccountData  rememberMeAccountData = null;

            try
            {
                rememberMeAccountData = Service.Get <JsonService>().Deserialize <RememberMeAccountData>(accountDataCache.GetValue());
            }
            catch
            {
            }
            if (rememberMeAccountData == null)
            {
                rememberMeAccountData = new RememberMeAccountData();
            }
            rememberMeAccountData.StoredData         = accountDataCache;
            rememberMeAccountData.Username           = username;
            rememberMeAccountData.KeychainCredential = getCredentialDataCache(username);
            return(rememberMeAccountData);
        }
예제 #7
0
 public GameSettings()
 {
     string[] commandLineArgs = Environment.GetCommandLineArgs();
     if (commandLineArgs != null && commandLineArgs.Contains("-clear-prefs"))
     {
         PlayerPrefs.DeleteAll();
     }
     NumDaysPlayed           = new CacheableType <int>("cp.NumDaysPlayed", 0);
     LastDayPlayed           = new CacheableType <string>("cp.LastDayPlayed", string.Empty);
     SfxEnabled              = new CacheableType <bool>("cp.SfxEnabled", defaultValue: true);
     SfxVolume               = new CacheableType <float>("cp.SfxVolume", 1f);
     MusicEnabled            = new CacheableType <bool>("cp.MusicEnabled", defaultValue: true);
     MusicVolume             = new CacheableType <float>("cp.MusicVolume", 1f);
     SavedLanguage           = new CacheableType <Language>("cp.SavedLanguage", Language.none);
     LastZone                = new CacheableType <string>("cp.LastZone", "");
     KeyboardHeight          = new CacheableType <float>("cp.KeyboardHeight", 0.38f);
     EnablePushNotifications = new CacheableType <bool>("cp.EnablePushNotifications", defaultValue: true);
     SkipFTUE                = new DevCacheableType <bool>("cp.SkipFTUE", defaultValue: false);
     BypassCaptcha           = new DevCacheableType <bool>("cp.BypassCaptcha", defaultValue: false);
     FirstLoadOfApp          = new CacheableType <bool>("cp.FirstLoadOfApp", defaultValue: true);
     FirstSession            = FirstLoadOfApp;
     FirstLoadOfApp.SetValue(value: false);
     SeenInAppPurchaseDisclaimerPrompt = new CacheableType <bool>("cp.SeenInAppPurchaseDisclaimerPrompt", defaultValue: false);
     EnableAnalyticsLogging            = new DevCacheableType <bool>("cp.EnableAnalyticsLogging", defaultValue: true);
     GameServerHost         = new CacheableType <string>("cp.network.GameServerHost", "");
     CPAPIServicehost       = new CacheableType <string>("cp.network.CPAPIServicehost", "");
     GuestControllerHostUrl = new CacheableType <string>("cp.network.GuestControllerHostUrl", "");
     GuestControllerCDNUrl  = new CacheableType <string>("cp.network.GuestControllerCDNUrl", "");
     MixAPIHostUrl          = new CacheableType <string>("cp.network.MixAPIHostUrl", "");
     CDN = new CacheableType <string>("cp.network.CDN", "");
     CPWebsiteAPIServicehost = new CacheableType <string>("cp.network.CPWebsiteAPIServicehost", "");
     AutoLogin = new DevCacheableType <bool>("cp.AutoLogin", defaultValue: true);
     resetableGenericSettings = new HashSet <ICachableType>();
     if (DateTime.UtcNow > new DateTime(2018, 12, 21))
     {
         OfflineMode = true;
     }
 }
예제 #8
0
        private bool isUserNameValid(string username)
        {
            CacheableType <string> accountDataCache = getAccountDataCache(username);

            return(!string.IsNullOrEmpty(accountDataCache.GetValue()) && !(accountDataCache.GetValue() == "{}"));
        }
예제 #9
0
        private static Type ResolveStoredType(CacheableType input)
        {
            switch (input)
            {
            case CacheableType.FieldList:
                return(typeof(FieldList));

            case CacheableType.AtomicBlockDefinition:
                return(typeof(AtomicBlockDefinition));

            case CacheableType.BoxLayoutBlockDefinition:
                return(typeof(BoxLayoutBlockDefinition));

            case CacheableType.GridBlockDefinition:
                return(typeof(GridBlockDefinition));

            case CacheableType.ListBlockDefinition:
                return(typeof(ListBlockDefinition));

            case CacheableType.SingleSlotBlockDefinition:
                return(typeof(SingleSlotBlockDefinition));

            case CacheableType.FrameDefinition:
                return(typeof(FrameDefinition));

            case CacheableType.ScrollingTextBlockDefinition:
                return(typeof(ScrollingTextBlockDefinition));

            case CacheableType.MapPluginBlockDefinition:
                return(typeof(MapPluginBlockDefinition));

            case CacheableType.PaletteDefinition:
                return(typeof(PaletteDefinition));

            case CacheableType.FontDefinition:
                return(typeof(FontDefinition));

            case CacheableType.ApplicationEvents:
                return(typeof(ApplicationEventsDefinition));

            case CacheableType.TableLayoutTemplate:
                return(typeof(TableLayoutTemplate));

            case CacheableType.InheritedPaletteEntry:
                return(typeof(InheritedPaletteEntry));

            case CacheableType.DoNotPaintPaletteEntry:
                return(typeof(DoNotPaintPaletteEntry));

            case CacheableType.FontReferencePaletteEntry:
                return(typeof(FontReferencePaletteEntry));

            case CacheableType.ColourPaletteEntry:
                return(typeof(ColourPaletteEntry));

            case CacheableType.LinearGradientPaletteEntry:
                return(typeof(LinearGradientPaletteEntry));

            case CacheableType.ColourSequencePaletteEntry:
                return(typeof(ColourSequencePaletteEntry));

            case CacheableType.PaletteReferencePaletteEntry:
                return(typeof(PaletteReferencePaletteEntry));

            case CacheableType.StyleSet:
                return(typeof(StyleSet));
            }

            return(null);
        }