Exemple #1
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            var hiddenValue = prop.FindPropertyRelative("hiddenValue");

            SetBoldIfValueOverridePrefab(prop, hiddenValue);

            var cryptoKey = prop.FindPropertyRelative("currentCryptoKey");
            var inited    = prop.FindPropertyRelative("inited");

            var  currentCryptoKey = cryptoKey.longValue;
            long val = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.longValue = ObscuredLong.cryptoKeyEditor;
                }
                hiddenValue.longValue = ObscuredLong.Encrypt(0, currentCryptoKey);
                inited.boolValue      = true;
            }
            else
            {
                val = ObscuredLong.Decrypt(hiddenValue.longValue, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.LongField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                hiddenValue.longValue = ObscuredLong.Encrypt(val, currentCryptoKey);
            }

            ResetBoldFont();
        }
Exemple #2
0
 public void SetExp(int i)
 {
     this.exp = i;
     if (ChangeInfoEvent != null)
     {
         ChangeInfoEvent();
     }
 }
Exemple #3
0
 public void SetGold(int i)
 {
     this.coin = i;
     if (ChangeInfoEvent != null)
     {
         ChangeInfoEvent();
     }
 }
Exemple #4
0
 public void SetFriendPoint(int i)
 {
     this.friend_point = i;
     if (ChangeInfoEvent != null)
     {
         ChangeInfoEvent();
     }
 }
Exemple #5
0
 public void SetDiamond(int i)
 {
     Debug.Log(i);
     this.diamond = i;
     if (ChangeInfoEvent != null)
     {
         ChangeInfoEvent();
     }
 }
Exemple #6
0
    public void SetUser(C2sSprotoType.user u)
    {
        Debug.Log("用户信息获取成 recharge_diamond" + u.recharge_diamond + "level" + level + "hanging_checkpoint" + u.cp_hanging_id + "u.cp_chapter" + u.cp_chapter);
        level    = (int)u.level;
        curDay   = DateTime.Now.Day;
        curMonth = DateTime.Now.Month;


        exp        = u.uexp;
        vip_level  = (int)u.uviplevel;
        curVipdata = GameShared.Instance.GetVipByLevel((int)vip_level);


        coin           = u.gold;
        diamond        = (int)u.diamond;
        nickName       = u.uname;
        friend_point   = (int)u.love;
        signTxt        = u.sign;
        recharge_total = (int)u.recharge_diamond;

        curUnLockChapter = (int)u.cp_chapter + 1;
        battleRoleID     = (int)u.c_role_id;


        ArenaMgr.Instance.curRank = (int)u.ara_rnk;
        lilian_level = (int)u.lilian_level;


        if (u.cp_hanging_id != 0)
        {
            curLeveldata = GameShared.Instance.GetLevelById((int)u.cp_hanging_id);
        }

        RoleTable  = GameShared.Instance.roleTable;
        boxTable   = new Hashtable();
        equipTable = new Hashtable();

        InitRoleData(u);
        InitBoxingData(u);
        InitEquipData(u);
        InitHallData();

        curRole = GameShared.Instance.GetRoleById(battleRoleID);
        curRole.is_possessed = true;

        RestUserAttr();

        if (ChangeInfoEvent != null)
        {
            ChangeInfoEvent();
        }
    }
    private void TestLong()
    {
#if !UNITY_FLASH
        Debug.Log("  Testing ObscuredLong vs long preformance:\n  " + longIterations + " iterations for read and same for write");

        Stopwatch    sw          = Stopwatch.StartNew();
        ObscuredLong obscured    = 100L;
        long         notObscured = obscured;
        long         dummy       = 0;

        for (int i = 0; i < longIterations; i++)
        {
            dummy = obscured;
        }

        for (int i = 0; i < longIterations; i++)
        {
            obscured = dummy;
        }

        Debug.Log("    ObscuredLong:\n    " + sw.ElapsedMilliseconds + " ms ");
        sw.Reset();

        sw.Start();
        for (int i = 0; i < longIterations; i++)
        {
            dummy = notObscured;
        }

        for (int i = 0; i < longIterations; i++)
        {
            notObscured = dummy;
        }

        sw.Stop();
        Debug.Log("    long:\n    " + sw.ElapsedMilliseconds + "  ms ");

        if (dummy != 0)
        {
        }
        if (obscured != 0)
        {
        }
        if (notObscured != 0)
        {
        }
#endif
    }
        private void TestLong()
        {
            logBuilder.AppendLine("ObscuredLong vs long, " + longIterations + " iterations for read and write");

            ObscuredLong obscured    = 100L;
            long         notObscured = obscured;
            long         dummy       = 0;

            var sw = Stopwatch.StartNew();

            for (var i = 0; i < longIterations; i++)
            {
                dummy = obscured;
            }

            for (var i = 0; i < longIterations; i++)
            {
                obscured = dummy;
            }
            sw.Stop();
            logBuilder.AppendLine("ObscuredLong:").AppendLine(sw.ElapsedMilliseconds + " ms");

            sw.Reset();
            sw.Start();
            for (var i = 0; i < longIterations; i++)
            {
                dummy = notObscured;
            }

            for (var i = 0; i < longIterations; i++)
            {
                notObscured = dummy;
            }
            sw.Stop();
            logBuilder.AppendLine("long:").AppendLine(sw.ElapsedMilliseconds + " ms");

            if (dummy != 0)
            {
            }
            if (obscured != 0)
            {
            }
            if (notObscured != 0)
            {
            }
        }
Exemple #9
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
#if !UNITY_5_0_PLUS
            EditorGUI.LabelField(position, label.text + " [works in Unity 5+]");
#else
            SerializedProperty hiddenValue = prop.FindPropertyRelative("hiddenValue");
            SetBoldIfValueOverridePrefab(prop, hiddenValue);

            SerializedProperty cryptoKey       = prop.FindPropertyRelative("currentCryptoKey");
            SerializedProperty inited          = prop.FindPropertyRelative("inited");
            SerializedProperty fakeValue       = prop.FindPropertyRelative("fakeValue");
            SerializedProperty fakeValueActive = prop.FindPropertyRelative("fakeValueActive");

            long currentCryptoKey = cryptoKey.longValue;
            long val = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.longValue = ObscuredLong.cryptoKeyEditor;
                }
                hiddenValue.longValue = ObscuredLong.Encrypt(0, currentCryptoKey);
                inited.boolValue      = true;
                fakeValue.longValue   = 0;
            }
            else
            {
                val = ObscuredLong.Decrypt(hiddenValue.longValue, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.LongField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                hiddenValue.longValue     = ObscuredLong.Encrypt(val, currentCryptoKey);
                fakeValue.longValue       = val;
                fakeValueActive.boolValue = true;
            }

            ResetBoldFont();
#endif
        }
Exemple #10
0
        private void TestLong()
        {
            this.logBuilder.AppendLine("ObscuredLong vs long, " + this.longIterations + " iterations for read and write");
            ObscuredLong value     = 100L;
            long         num       = value;
            long         num2      = 0L;
            Stopwatch    stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < this.longIterations; i++)
            {
                num2 = value;
            }
            for (int j = 0; j < this.longIterations; j++)
            {
                value = num2;
            }
            stopwatch.Stop();
            this.logBuilder.AppendLine("ObscuredLong:").AppendLine(stopwatch.ElapsedMilliseconds + " ms");
            stopwatch.Reset();
            stopwatch.Start();
            for (int k = 0; k < this.longIterations; k++)
            {
                num2 = num;
            }
            for (int l = 0; l < this.longIterations; l++)
            {
                num = num2;
            }
            stopwatch.Stop();
            this.logBuilder.AppendLine("long:").AppendLine(stopwatch.ElapsedMilliseconds + " ms");
            if (num2 != 0L)
            {
            }
            if (value != 0L)
            {
            }
            if (num != 0L)
            {
            }
        }
    private void TestLong()
    {
        UnityEngine.Debug.Log("  Testing ObscuredLong vs long preformance:\n  " + longIterations + " iterations for read and same for write");
        Stopwatch    stopwatch = Stopwatch.StartNew();
        ObscuredLong value     = 100L;
        long         num       = value;
        long         num2      = 0L;

        for (int i = 0; i < longIterations; i++)
        {
            num2 = value;
        }
        for (int j = 0; j < longIterations; j++)
        {
            value = num2;
        }
        UnityEngine.Debug.Log("    ObscuredLong:\n    " + stopwatch.ElapsedMilliseconds + " ms ");
        stopwatch.Reset();
        stopwatch.Start();
        for (int k = 0; k < longIterations; k++)
        {
            num2 = num;
        }
        for (int l = 0; l < longIterations; l++)
        {
            num = num2;
        }
        stopwatch.Stop();
        UnityEngine.Debug.Log("    long:\n    " + stopwatch.ElapsedMilliseconds + "  ms ");
        if (num2 != 0L)
        {
        }
        if ((long)value != 0L)
        {
        }
        if (num == 0L)
        {
        }
    }
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            var hiddenValue = prop.FindPropertyRelative("hiddenValue");

            var cryptoKey       = prop.FindPropertyRelative("currentCryptoKey");
            var inited          = prop.FindPropertyRelative("inited");
            var fakeValue       = prop.FindPropertyRelative("fakeValue");
            var fakeValueActive = prop.FindPropertyRelative("fakeValueActive");

            var  currentCryptoKey = cryptoKey.longValue;
            long val = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.longValue = ObscuredLong.GenerateKey();
                }
                hiddenValue.longValue = ObscuredLong.Encrypt(0, currentCryptoKey);
                inited.boolValue      = true;
                fakeValue.longValue   = 0;
            }
            else
            {
                val = ObscuredLong.Decrypt(hiddenValue.longValue, currentCryptoKey);
            }

            label = EditorGUI.BeginProperty(position, label, prop);

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.LongField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                hiddenValue.longValue     = ObscuredLong.Encrypt(val, currentCryptoKey);
                fakeValue.longValue       = val;
                fakeValueActive.boolValue = true;
            }
            EditorGUI.EndProperty();
        }
Exemple #13
0
        public static void MigrateObscuredTypesOnPrefabs()
        {
            if (!EditorUtility.DisplayDialog("ACTk Obscured types migration",
                                             "Are you sure you wish to scan all prefabs in your project and automatically migrate values to the new format?",
                                             "Yes", "No"))
            {
                Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Obscured types migration was cancelled by user.");
                return;
            }

            AssetDatabase.SaveAssets();

            string[] assets = AssetDatabase.FindAssets("t:ScriptableObject t:Prefab");
            //string[] prefabs = AssetDatabase.FindAssets("TestPrefab");
            int touchedCount = 0;
            int count        = assets.Length;

            for (int i = 0; i < count; i++)
            {
                if (EditorUtility.DisplayCancelableProgressBar("Looking through objects", "Object " + (i + 1) + " from " + count,
                                                               i / (float)count))
                {
                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Obscured types migration was cancelled by user.");
                    break;
                }

                string guid = assets[i];
                string path = AssetDatabase.GUIDToAssetPath(guid);

                Object[] objects = AssetDatabase.LoadAllAssetsAtPath(path);
                foreach (Object unityObject in objects)
                {
                    if (unityObject == null)
                    {
                        continue;
                    }
                    if (unityObject.name == "Deprecated EditorExtensionImpl")
                    {
                        continue;
                    }

                    bool modified         = false;
                    var  so               = new SerializedObject(unityObject);
                    SerializedProperty sp = so.GetIterator();

                    if (sp == null)
                    {
                        continue;
                    }

                    while (sp.NextVisible(true))
                    {
                        if (sp.propertyType != SerializedPropertyType.Generic)
                        {
                            continue;
                        }

                        string type = sp.type;

                        switch (type)
                        {
                        case "ObscuredBool":
                        {
                            SerializedProperty hiddenValue      = sp.FindPropertyRelative("hiddenValue");
                            SerializedProperty cryptoKey        = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue        = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueChanged = sp.FindPropertyRelative("fakeValueChanged");
                            SerializedProperty fakeValueActive  = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited           = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                int  currentCryptoKey = cryptoKey.intValue;
                                bool real             = ObscuredBool.Decrypt(hiddenValue.intValue, (byte)currentCryptoKey);
                                bool fake             = fakeValue.boolValue;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.boolValue = real;
                                    if (fakeValueChanged != null)
                                    {
                                        fakeValueChanged.boolValue = true;
                                    }
                                    if (fakeValueActive != null)
                                    {
                                        fakeValueActive.boolValue = true;
                                    }
                                    modified = true;
                                }
                            }
                        }
                        break;

                        case "ObscuredDouble":
                        {
                            SerializedProperty hiddenValue = sp.FindPropertyRelative("hiddenValue");
                            if (hiddenValue == null)
                            {
                                continue;
                            }

                            SerializedProperty hiddenValue1 = hiddenValue.FindPropertyRelative("b1");
                            SerializedProperty hiddenValue2 = hiddenValue.FindPropertyRelative("b2");
                            SerializedProperty hiddenValue3 = hiddenValue.FindPropertyRelative("b3");
                            SerializedProperty hiddenValue4 = hiddenValue.FindPropertyRelative("b4");
                            SerializedProperty hiddenValue5 = hiddenValue.FindPropertyRelative("b5");
                            SerializedProperty hiddenValue6 = hiddenValue.FindPropertyRelative("b6");
                            SerializedProperty hiddenValue7 = hiddenValue.FindPropertyRelative("b7");
                            SerializedProperty hiddenValue8 = hiddenValue.FindPropertyRelative("b8");

                            SerializedProperty hiddenValueOld = sp.FindPropertyRelative("hiddenValueOld");

                            if (hiddenValueOld != null && hiddenValueOld.isArray && hiddenValueOld.arraySize == 8)
                            {
                                hiddenValue1.intValue = hiddenValueOld.GetArrayElementAtIndex(0).intValue;
                                hiddenValue2.intValue = hiddenValueOld.GetArrayElementAtIndex(1).intValue;
                                hiddenValue3.intValue = hiddenValueOld.GetArrayElementAtIndex(2).intValue;
                                hiddenValue4.intValue = hiddenValueOld.GetArrayElementAtIndex(3).intValue;
                                hiddenValue5.intValue = hiddenValueOld.GetArrayElementAtIndex(4).intValue;
                                hiddenValue6.intValue = hiddenValueOld.GetArrayElementAtIndex(5).intValue;
                                hiddenValue7.intValue = hiddenValueOld.GetArrayElementAtIndex(6).intValue;
                                hiddenValue8.intValue = hiddenValueOld.GetArrayElementAtIndex(7).intValue;

                                hiddenValueOld.arraySize = 0;

                                Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Migrated property " + sp.displayName + ":" + type +
                                          " at the object " + unityObject.name + "\n" + path);
                                modified = true;
                            }

#if UNITY_5_0_PLUS
                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                var union = new LongBytesUnion();
                                union.b8.b1 = (byte)hiddenValue1.intValue;
                                union.b8.b2 = (byte)hiddenValue2.intValue;
                                union.b8.b3 = (byte)hiddenValue3.intValue;
                                union.b8.b4 = (byte)hiddenValue4.intValue;
                                union.b8.b5 = (byte)hiddenValue5.intValue;
                                union.b8.b6 = (byte)hiddenValue6.intValue;
                                union.b8.b7 = (byte)hiddenValue7.intValue;
                                union.b8.b8 = (byte)hiddenValue8.intValue;

                                long   currentCryptoKey = cryptoKey.longValue;
                                double real             = ObscuredDouble.Decrypt(union.l, currentCryptoKey);
                                double fake             = fakeValue.doubleValue;

                                if (Math.Abs(real - fake) > 0.0000001d)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);

                                    fakeValue.doubleValue     = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
#endif
                        }
                        break;

                        case "ObscuredFloat":
                        {
                            SerializedProperty hiddenValue = sp.FindPropertyRelative("hiddenValue");
                            if (hiddenValue == null)
                            {
                                continue;
                            }

                            SerializedProperty hiddenValue1 = hiddenValue.FindPropertyRelative("b1");
                            SerializedProperty hiddenValue2 = hiddenValue.FindPropertyRelative("b2");
                            SerializedProperty hiddenValue3 = hiddenValue.FindPropertyRelative("b3");
                            SerializedProperty hiddenValue4 = hiddenValue.FindPropertyRelative("b4");

                            SerializedProperty hiddenValueOld = sp.FindPropertyRelative("hiddenValueOld");

                            if (hiddenValueOld != null && hiddenValueOld.isArray && hiddenValueOld.arraySize == 4)
                            {
                                hiddenValue1.intValue = hiddenValueOld.GetArrayElementAtIndex(0).intValue;
                                hiddenValue2.intValue = hiddenValueOld.GetArrayElementAtIndex(1).intValue;
                                hiddenValue3.intValue = hiddenValueOld.GetArrayElementAtIndex(2).intValue;
                                hiddenValue4.intValue = hiddenValueOld.GetArrayElementAtIndex(3).intValue;

                                hiddenValueOld.arraySize = 0;

                                Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Migrated property " + sp.displayName + ":" + type +
                                          " at the object " + unityObject.name + "\n" + path);
                                modified = true;
                            }

                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                var union = new IntBytesUnion();
                                union.b4.b1 = (byte)hiddenValue1.intValue;
                                union.b4.b2 = (byte)hiddenValue2.intValue;
                                union.b4.b3 = (byte)hiddenValue3.intValue;
                                union.b4.b4 = (byte)hiddenValue4.intValue;

                                int   currentCryptoKey = cryptoKey.intValue;
                                float real             = ObscuredFloat.Decrypt(union.i, currentCryptoKey);
                                float fake             = fakeValue.floatValue;
                                if (Math.Abs(real - fake) > 0.0000001f)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);

                                    fakeValue.floatValue      = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;

                        case "ObscuredInt":
                        {
                            SerializedProperty hiddenValue     = sp.FindPropertyRelative("hiddenValue");
                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                int currentCryptoKey = cryptoKey.intValue;
                                int real             = ObscuredInt.Decrypt(hiddenValue.intValue, currentCryptoKey);
                                int fake             = fakeValue.intValue;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.intValue        = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;

#if UNITY_5_0_PLUS
                        case "ObscuredLong":
                        {
                            SerializedProperty hiddenValue     = sp.FindPropertyRelative("hiddenValue");
                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                long currentCryptoKey = cryptoKey.longValue;
                                long real             = ObscuredLong.Decrypt(hiddenValue.longValue, currentCryptoKey);
                                long fake             = fakeValue.longValue;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.longValue       = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;

                        case "ObscuredShort":
                        {
                            SerializedProperty hiddenValue     = sp.FindPropertyRelative("hiddenValue");
                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                short currentCryptoKey = (short)cryptoKey.intValue;
                                short real             = ObscuredShort.EncryptDecrypt((short)hiddenValue.intValue, currentCryptoKey);
                                short fake             = (short)fakeValue.intValue;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.intValue        = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;
#endif
                        case "ObscuredString":
                        {
                            SerializedProperty hiddenValue     = sp.FindPropertyRelative("hiddenValue");
                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                string currentCryptoKey = cryptoKey.stringValue;
                                byte[] bytes            = new byte[hiddenValue.arraySize];
                                for (int j = 0; j < hiddenValue.arraySize; j++)
                                {
                                    bytes[j] = (byte)hiddenValue.GetArrayElementAtIndex(j).intValue;
                                }

                                string real = ObscuredString.EncryptDecrypt(GetString(bytes), currentCryptoKey);
                                string fake = fakeValue.stringValue;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.stringValue     = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;

#if UNITY_5_0_PLUS
                        case "ObscuredUInt":
                        {
                            SerializedProperty hiddenValue     = sp.FindPropertyRelative("hiddenValue");
                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                uint currentCryptoKey = (uint)cryptoKey.intValue;
                                uint real             = ObscuredUInt.Decrypt((uint)hiddenValue.intValue, currentCryptoKey);
                                uint fake             = (uint)fakeValue.intValue;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.intValue        = (int)real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;

                        case "ObscuredULong":
                        {
                            SerializedProperty hiddenValue     = sp.FindPropertyRelative("hiddenValue");
                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                ulong currentCryptoKey = (ulong)cryptoKey.longValue;
                                ulong real             = ObscuredULong.Decrypt((ulong)hiddenValue.longValue, currentCryptoKey);
                                ulong fake             = (ulong)fakeValue.longValue;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.longValue       = (long)real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;
#endif
                        case "ObscuredVector2":
                        {
                            SerializedProperty hiddenValue = sp.FindPropertyRelative("hiddenValue");
                            if (hiddenValue == null)
                            {
                                continue;
                            }

                            SerializedProperty hiddenValueX = hiddenValue.FindPropertyRelative("x");
                            SerializedProperty hiddenValueY = hiddenValue.FindPropertyRelative("y");

                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                ObscuredVector2.RawEncryptedVector2 ev = new ObscuredVector2.RawEncryptedVector2();
                                ev.x = hiddenValueX.intValue;
                                ev.y = hiddenValueY.intValue;

                                int     currentCryptoKey = cryptoKey.intValue;
                                Vector2 real             = ObscuredVector2.Decrypt(ev, currentCryptoKey);
                                Vector2 fake             = fakeValue.vector2Value;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.vector2Value    = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;

                        case "ObscuredVector3":
                        {
                            SerializedProperty hiddenValue = sp.FindPropertyRelative("hiddenValue");
                            if (hiddenValue == null)
                            {
                                continue;
                            }

                            SerializedProperty hiddenValueX = hiddenValue.FindPropertyRelative("x");
                            SerializedProperty hiddenValueY = hiddenValue.FindPropertyRelative("y");
                            SerializedProperty hiddenValueZ = hiddenValue.FindPropertyRelative("z");

                            SerializedProperty cryptoKey       = sp.FindPropertyRelative("currentCryptoKey");
                            SerializedProperty fakeValue       = sp.FindPropertyRelative("fakeValue");
                            SerializedProperty fakeValueActive = sp.FindPropertyRelative("fakeValueActive");
                            SerializedProperty inited          = sp.FindPropertyRelative("inited");

                            if (inited != null && inited.boolValue)
                            {
                                var ev = new ObscuredVector3.RawEncryptedVector3();
                                ev.x = hiddenValueX.intValue;
                                ev.y = hiddenValueY.intValue;
                                ev.z = hiddenValueZ.intValue;

                                int     currentCryptoKey = cryptoKey.intValue;
                                Vector3 real             = ObscuredVector3.Decrypt(ev, currentCryptoKey);
                                Vector3 fake             = fakeValue.vector3Value;

                                if (real != fake)
                                {
                                    Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Fixed property " + sp.displayName + ":" + type +
                                              " at the object " + unityObject.name + "\n" + path);
                                    fakeValue.vector3Value    = real;
                                    fakeValueActive.boolValue = true;
                                    modified = true;
                                }
                            }
                        }
                        break;
                        }
                    }

                    if (modified)
                    {
                        touchedCount++;
                        so.ApplyModifiedProperties();
                        EditorUtility.SetDirty(unityObject);
                    }
                }
            }

            AssetDatabase.SaveAssets();

            EditorUtility.ClearProgressBar();

            if (touchedCount > 0)
            {
                Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "Migrated obscured types on " + touchedCount + " objects.");
            }
            else
            {
                Debug.Log(ActEditorGlobalStuff.LOG_PREFIX + "No objects were found for obscured types migration.");
            }
        }
Exemple #14
0
 public void AddExp(int i)
 {
     exp += i;
     SetExp((int)exp);
 }
Exemple #15
0
 public void SubExp(int i)
 {
     exp -= i;
     SetExp((int)exp);
 }
Exemple #16
0
 public void AddFriendPoint(int i)
 {
     friend_point += i;
     SetFriendPoint((int)friend_point);
 }
Exemple #17
0
 public void SubFriendPoint(int i)
 {
     friend_point -= i;
     SetFriendPoint((int)friend_point);
 }
Exemple #18
0
 public void SubDiamond(int i)
 {
     diamond -= i;
     SetDiamond((int)diamond);
 }
Exemple #19
0
 public void AddDiamond(int i)
 {
     diamond += i;
     SetDiamond((int)diamond);
 }
Exemple #20
0
 public void SubCoin(int i)
 {
     coin -= i;
     SetGold((int)coin);
 }
Exemple #21
0
 public void AddCoin(int i)
 {
     coin += i;
     SetGold((int)coin);
 }
Exemple #22
0
 public OLong(long value)
 {
     this.value = (ObscuredLong)value;
 }