public void SetULong(Option option, ulong val)
    {
        string str;

        if (this.m_clientOptionMap.TryGetValue(option, out str))
        {
            bool  existed = LocalOptions.Get().Has(str);
            ulong uLong   = LocalOptions.Get().GetULong(str);
            if (!existed || (uLong != val))
            {
                LocalOptions.Get().Set(str, val);
                this.FireChangedEvent(option, uLong, existed);
            }
        }
        else
        {
            ServerOption option2;
            if (this.m_serverOptionMap.TryGetValue(option, out option2))
            {
                ulong num2;
                bool  uLongOption = NetCache.Get().GetULongOption(option2, out num2);
                if (!uLongOption || (num2 != val))
                {
                    NetCache.Get().SetULongOption(option2, val);
                    this.FireChangedEvent(option, num2, uLongOption);
                }
            }
        }
    }
    public void SetInt(Option option, int val)
    {
        string str;

        if (this.m_clientOptionMap.TryGetValue(option, out str))
        {
            bool existed = LocalOptions.Get().Has(str);
            int  @int    = LocalOptions.Get().GetInt(str);
            if (!existed || (@int != val))
            {
                LocalOptions.Get().Set(str, val);
                this.FireChangedEvent(option, @int, existed);
            }
        }
        else
        {
            ServerOption option2;
            if (this.m_serverOptionMap.TryGetValue(option, out option2))
            {
                int  num2;
                bool intOption = NetCache.Get().GetIntOption(option2, out num2);
                if (!intOption || (num2 != val))
                {
                    NetCache.Get().SetIntOption(option2, val);
                    this.FireChangedEvent(option, num2, intOption);
                }
            }
        }
    }
 private object GetClientOption(Option option, string optionName)
 {
     System.Type optionType = this.GetOptionType(option);
     if (optionType == typeof(bool))
     {
         return(LocalOptions.Get().GetBool(optionName));
     }
     if (optionType == typeof(int))
     {
         return(LocalOptions.Get().GetInt(optionName));
     }
     if (optionType == typeof(long))
     {
         return(LocalOptions.Get().GetLong(optionName));
     }
     if (optionType == typeof(ulong))
     {
         return(LocalOptions.Get().GetULong(optionName));
     }
     if (optionType == typeof(float))
     {
         return(LocalOptions.Get().GetFloat(optionName));
     }
     if (optionType == typeof(string))
     {
         return(LocalOptions.Get().GetString(optionName));
     }
     object[] messageArgs = new object[] { option, optionType };
     Error.AddDevFatal("Options.GetClientOption() - option {0} has unsupported underlying type {1}", messageArgs);
     return(null);
 }
 private void DeleteClientOption(Option option, string optionName)
 {
     if (LocalOptions.Get().Has(optionName))
     {
         object clientOption = this.GetClientOption(option, optionName);
         LocalOptions.Get().Delete(optionName);
         this.RemoveListeners(option, clientOption);
     }
 }
    public void SetString(Option option, string val)
    {
        string str;

        if (this.m_clientOptionMap.TryGetValue(option, out str))
        {
            bool   existed = LocalOptions.Get().Has(str);
            string prevVal = LocalOptions.Get().GetString(str);
            if (!existed || (prevVal != val))
            {
                LocalOptions.Get().Set(str, val);
                this.FireChangedEvent(option, prevVal, existed);
            }
        }
    }
    public bool HasOption(Option option)
    {
        string           str;
        ServerOption     option2;
        ServerOptionFlag flag;

        if (this.m_clientOptionMap.TryGetValue(option, out str))
        {
            return(LocalOptions.Get().Has(str));
        }
        if (this.m_serverOptionMap.TryGetValue(option, out option2))
        {
            return(NetCache.Get().ClientOptionExists(option2));
        }
        return(this.m_serverOptionFlagMap.TryGetValue(option, out flag) && this.HasServerOptionFlag(flag));
    }
    private bool GetOptionImpl(Option option, out object val)
    {
        string str;

        val = null;
        if (this.m_clientOptionMap.TryGetValue(option, out str))
        {
            if (LocalOptions.Get().Has(str))
            {
                val = this.GetClientOption(option, str);
            }
        }
        else
        {
            ServerOption option2;
            if (this.m_serverOptionMap.TryGetValue(option, out option2))
            {
                if (NetCache.Get().ClientOptionExists(option2))
                {
                    val = this.GetServerOption(option, option2);
                }
            }
            else
            {
                ServerOptionFlag flag;
                if (this.m_serverOptionFlagMap.TryGetValue(option, out flag))
                {
                    ulong num;
                    ulong num2;
                    this.GetServerOptionFlagInfo(flag, out option2, out num, out num2);
                    ulong uLongOption = NetCache.Get().GetULongOption(option2);
                    if ((uLongOption & num2) != 0L)
                    {
                        val = (uLongOption & num) != 0L;
                    }
                }
            }
        }
        return(val != null);
    }
Ejemplo n.º 8
0
 private void InitializeGame()
 {
     GameDbf.Load();
     DemoMgr.Get().Initialize();
     LocalOptions.Get().Initialize();
     if (DemoMgr.Get().GetMode() == DemoMode.APPLE_STORE)
     {
         DemoMgr.Get().ApplyAppleStoreDemoDefaults();
     }
     if (Network.TUTORIALS_WITHOUT_ACCOUNT != null)
     {
         Network.SetShouldBeConnectedToAurora(Options.Get().GetBool(Option.CONNECT_TO_AURORA));
     }
     Network.Initialize();
     Localization.Initialize();
     GameStrings.LoadCategory(GameStringCategory.GLOBAL);
     if (!PlayErrors.Init())
     {
         UnityEngine.Debug.LogError(string.Format("{0} failed to load!", "PlayErrors32"));
     }
     GameMgr.Get().Initialize();
     ChangedCardMgr.Get().Initialize();
     TavernBrawlManager.Init();
 }
    public void SetBool(Option option, bool val)
    {
        string str;

        if (this.m_clientOptionMap.TryGetValue(option, out str))
        {
            bool existed = LocalOptions.Get().Has(str);
            bool @bool   = LocalOptions.Get().GetBool(str);
            if (!existed || (@bool != val))
            {
                LocalOptions.Get().Set(str, val);
                this.FireChangedEvent(option, @bool, existed);
            }
        }
        else
        {
            ServerOptionFlag flag3;
            if (this.m_serverOptionFlagMap.TryGetValue(option, out flag3))
            {
                ServerOption option2;
                ulong        num;
                ulong        num2;
                this.GetServerOptionFlagInfo(flag3, out option2, out num, out num2);
                ulong uLongOption = NetCache.Get().GetULongOption(option2);
                bool  prevVal     = (uLongOption & num) != 0L;
                bool  flag5       = (uLongOption & num2) != 0L;
                if (!flag5 || (prevVal != val))
                {
                    ulong num4 = !val ? (uLongOption & ~num) : (uLongOption | num);
                    num4 |= num2;
                    NetCache.Get().SetULongOption(option2, num4);
                    this.FireChangedEvent(option, prevVal, flag5);
                }
            }
        }
    }