Пример #1
0
    void UpdatePlaceModify()
    {
        //영지 효과 퀘스트 보상 증가
        placeModifyIncreaseIncome = 0f;
        for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++)
        {
            PlaceData placeData = TerritoryManager.Instance.myPlaceList[i];
            if (placeData.placeBaseData.type == "Battle_IncreaseQuestExpRatio")
            {
                float a = 0f;
                float.TryParse(placeData.placeBaseData.formula, out a);
                placeModifyIncreaseIncome += a * 0.01f * placeData.placeLevel;
            }
        }

        //영지 효과 - 퀘스트 레벨업 비용 감소
        for (int i = 0; i < TerritoryManager.Instance.myPlaceList.Count; i++)
        {
            PlaceData placeData = TerritoryManager.Instance.myPlaceList[i];
            if (placeData.placeBaseData.type == "Battle_IncreaseNeedQuestExpRatio")
            {
                float a = 0f;
                float.TryParse(placeData.placeBaseData.formula, out a);
                placeModifyReduceUpgradeCost = a * 0.01f * placeData.placeLevel;
            }
        }


        //Debug.Log(placeModifyReduceUpgradeCost + ", " + income);
    }
        public ObscuredValueConverter()
        {
            list.Add(typeof(ObscuredInt), new Conv(
                         typeof(int),
                         o => { return((int)(ObscuredInt)o); },
                         o => { ObscuredInt value = Convert.ToInt32(o); return(value); }
                         ));
            list.Add(typeof(ObscuredFloat), new Conv(
                         typeof(float),
                         o => { return((float)(ObscuredFloat)o); },
                         o => { ObscuredFloat value = Convert.ToSingle(o); return(value); }
                         ));
            list.Add(typeof(ObscuredDouble), new Conv(
                         typeof(double),
                         o => { return((double)(ObscuredDouble)o); },
                         o => { ObscuredDouble value = Convert.ToSingle(o); return(value); }
                         ));

            list.Add(typeof(ObscuredBool), new Conv(
                         typeof(bool),
                         o => { return((bool)(ObscuredBool)o); },
                         o => { ObscuredBool value = Convert.ToBoolean(o); return(value); }
                         ));

            list.Add(typeof(ObscuredString), new Conv(
                         typeof(string),
                         o => { return((string)(ObscuredString)o); },
                         o => { ObscuredString value = o + ""; return(value); }
                         ));
        }
Пример #3
0
 public void ClickTheButton()
 {
     //+1 Pixl
     Counter += 1;
     if (Counter < 20)
     {
         SavePixls.PixlCount          += SavePixls.PixlsAdded;
         SavePixls.StatisticPixlCount += SavePixls.PixlsAdded;
         SavePixls.StatisticsClicks   += 1;
     }
 }
Пример #4
0
    void UpdateBaseIncome()
    {
        double tierModify     = Math.Pow(baseData.tier, 1.3d);
        double tierModifyPrev = Math.Pow(baseData.tier - 1, 1.3d);

        baseIncome = 0.2 * Math.Pow(7, tierModify /* - 1*/);

        baseIncomePrevTier = 0.2 * Math.Pow(7, tierModifyPrev);

        upgradeCostModify = Math.Pow(baseData.tier, 1.4);

        //Todo: 특성 등에 의한 수익량 증가 적용
    }
Пример #5
0
 private void Anti()
 {
     if (Counter >= 20)
     {
         Error.SetActive(true);
         Time    = 10;
         Counter = 0;
     }
     if (Counter < 20)
     {
         Counter = 0;
     }
 }/*
    private void TestDouble()
    {
#if !UNITY_FLASH
        Debug.Log("  Testing ObscuredDouble vs double preformance:\n  " + doubleIterations + " iterations for read and same for write");

        Stopwatch sw = Stopwatch.StartNew();

        ObscuredDouble obscured    = 100d;
        double         notObscured = obscured;
        double         dummy       = 0;

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

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

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

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

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

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

        if (dummy != 0)
        {
        }
        if (obscured != 0)
        {
        }
        if (notObscured != 0)
        {
        }
#endif
    }
Пример #7
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 fakeValue       = prop.FindPropertyRelative("fakeValue");
            var fakeValueActive = prop.FindPropertyRelative("fakeValueActive");

            var currentCryptoKey = cryptoKey.longValue;

            var    union = new LongBytesUnion();
            double val   = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.longValue = ObscuredDouble.cryptoKeyEditor;
                }

                inited.boolValue = true;

                union.l = ObscuredDouble.Encrypt(0, currentCryptoKey);
                hiddenValue.longValue = union.l;
            }
            else
            {
                union.l = hiddenValue.longValue;
                val     = ObscuredDouble.Decrypt(union.l, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.DoubleField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                union.l = ObscuredDouble.Encrypt(val, currentCryptoKey);
                hiddenValue.longValue = union.l;

                fakeValue.doubleValue     = val;
                fakeValueActive.boolValue = true;
            }

            ResetBoldFont();
        }
Пример #8
0
        private void TestDouble()
        {
            logBuilder.AppendLine("ObscuredDouble vs double, " + doubleIterations + " iterations for read and write");

            ObscuredDouble obscured    = 100d;
            double         notObscured = obscured;
            double         dummy       = 0;

            var sw = Stopwatch.StartNew();

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

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

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

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

            if (Math.Abs(dummy) > 0.00001d)
            {
            }
            if (Math.Abs(obscured) > 0.00001d)
            {
            }
            if (Math.Abs(notObscured) > 0.00001d)
            {
            }
        }
Пример #9
0
        private void TestDouble()
        {
            this.logBuilder.AppendLine("ObscuredDouble vs double, " + this.doubleIterations + " iterations for read and write");
            ObscuredDouble value     = 100.0;
            double         num       = value;
            double         num2      = 0.0;
            Stopwatch      stopwatch = Stopwatch.StartNew();

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

        for (int i = 0; i < doubleIterations; i++)
        {
            num2 = value;
        }
        for (int j = 0; j < doubleIterations; j++)
        {
            value = num2;
        }
        UnityEngine.Debug.Log("    ObscuredDouble:\n    " + stopwatch.ElapsedMilliseconds + " ms ");
        stopwatch.Reset();
        stopwatch.Start();
        for (int k = 0; k < doubleIterations; k++)
        {
            num2 = num;
        }
        for (int l = 0; l < doubleIterations; l++)
        {
            num = num2;
        }
        stopwatch.Stop();
        UnityEngine.Debug.Log("    double:\n    " + stopwatch.ElapsedMilliseconds + "  ms ");
        if (num2 != 0.0)
        {
        }
        if ((double)value != 0.0)
        {
        }
        if (num == 0.0)
        {
        }
    }
Пример #11
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.");
            }
        }
Пример #12
0
    public void CliamReward(ClaimRewardType itemType, ObscuredDouble amount, ObscuredInt amount_unit, Vector3 start_position)//GameRewardProperty data
    {
        switch (itemType)
        {
        case ClaimRewardType.Diamond:
            //  GameActionManager.Instance.InstanceFxDiamonds(Vector3.zero, UIGameManager.Instance.GetPositionHubDiamonds(), (int)amount);
            this.PostActionEvent(ActionEnums.ActionID.RefreshUIDiamonds);

            break;

        case ClaimRewardType.Coin:
            double _amount = amount;
            int    _unit   = amount_unit;

            Helper.FixUnit(ref _amount, ref _unit);
            // GameActionManager.Instance.InstanceFxCoins(Vector3.zero, UIGameManager.Instance.GetPositionHubCoins(), _amount, _unit);
            this.PostActionEvent(ActionEnums.ActionID.RefreshUICoins);
            break;

        case ClaimRewardType.Car:

            for (int i = 0; i < amount; i++)
            {
                //int level = PlayerData.LastLevelUnlocked;
                //level++;
                //GameManager.Instance.SetUnlockHighItem(level);
                GameManager.Instance.SetBoxReward(amount_unit);
            }

            ;
            break;

        case ClaimRewardType.CarAmount:
            PlayerData.CarCurrectAmount += (ObscuredInt)amount.GetDecrypted();
            break;

        case ClaimRewardType.Item:
            // get item
            break;

        case ClaimRewardType.Upgrade:
            //  EquipmentEnums.AbilityId equipmen = UpEquipment;



            //int level_upgrade = PlayerData.GetEquipmentUpgrade(UpEquipment);
            //level_upgrade++;
            //PlayerData.SaveEquipmentUpgrade(UpEquipment, level_upgrade);
            this.PostActionEvent(ActionEnums.ActionID.RefreshEquipmentData);

            //   OnUpgradeCompleted(UpEquipment);
            break;

        case ClaimRewardType.Buff:



            break;

        case ClaimRewardType.Wheel:
            int _num = PlayerData._LastNumberTurnSpin;
            _num++;
            PlayerData._LastNumberTurnSpin = Mathf.Min(_num, 3);

            break;

        case ClaimRewardType.WheelDouble:
            // WheelRedPackManager.Instance.isDouble = true;

            break;

        case ClaimRewardType.RedPack:

            InstanceFxRedPack(start_position, UIGameManager.Instance.GetPositionHubRedPack(), amount, 0);
            break;
        }
    }
Пример #13
0
 //public void CliamReward(ClaimRewardType itemType, double amount, int amount_unit,Vector3 start_position)
 //{
 //    start_position=Vector3.zero;
 //}
 public void CliamReward(ClaimRewardType itemType, ObscuredDouble amount, ObscuredInt amount_unit)//GameRewardProperty data
 {
     CliamReward(itemType, amount, amount_unit, Vector3.zero);
 }
Пример #14
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            var hiddenValue = prop.FindPropertyRelative("hiddenValue");

            var hiddenValueOldProperty = prop.FindPropertyRelative("hiddenValueOldByte8");
            var hiddenValueOld         = default(ACTkByte8);
            var oldValueExists         = false;

            if (hiddenValueOldProperty != null)
            {
                if (hiddenValueOldProperty.FindPropertyRelative("b1") != null)
                {
                    hiddenValueOld.b1 = (byte)hiddenValueOldProperty.FindPropertyRelative("b1").intValue;
                    hiddenValueOld.b2 = (byte)hiddenValueOldProperty.FindPropertyRelative("b2").intValue;
                    hiddenValueOld.b3 = (byte)hiddenValueOldProperty.FindPropertyRelative("b3").intValue;
                    hiddenValueOld.b4 = (byte)hiddenValueOldProperty.FindPropertyRelative("b4").intValue;
                    hiddenValueOld.b5 = (byte)hiddenValueOldProperty.FindPropertyRelative("b5").intValue;
                    hiddenValueOld.b6 = (byte)hiddenValueOldProperty.FindPropertyRelative("b6").intValue;
                    hiddenValueOld.b7 = (byte)hiddenValueOldProperty.FindPropertyRelative("b7").intValue;
                    hiddenValueOld.b8 = (byte)hiddenValueOldProperty.FindPropertyRelative("b8").intValue;

                    if (hiddenValueOld.b1 != 0 ||
                        hiddenValueOld.b2 != 0 ||
                        hiddenValueOld.b3 != 0 ||
                        hiddenValueOld.b4 != 0 ||
                        hiddenValueOld.b5 != 0 ||
                        hiddenValueOld.b6 != 0 ||
                        hiddenValueOld.b7 != 0 ||
                        hiddenValueOld.b8 != 0)
                    {
                        oldValueExists = true;
                    }
                }
            }

            SetBoldIfValueOverridePrefab(prop, 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;

            var    union = new LongBytesUnion();
            double val   = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.longValue = ObscuredDouble.cryptoKeyEditor;
                }

                inited.boolValue = true;

                union.l = ObscuredDouble.Encrypt(0, currentCryptoKey);
                hiddenValue.longValue = union.l;
            }
            else
            {
                if (oldValueExists)
                {
                    union.b8 = hiddenValueOld;
                    union.b8.Shuffle();
                }
                else
                {
                    union.l = hiddenValue.longValue;
                }

                val = ObscuredDouble.Decrypt(union.l, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.DoubleField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                union.l = ObscuredDouble.Encrypt(val, currentCryptoKey);
                hiddenValue.longValue = union.l;

                if (oldValueExists)
                {
                    hiddenValueOldProperty.FindPropertyRelative("b1").intValue = 0;
                    hiddenValueOldProperty.FindPropertyRelative("b2").intValue = 0;
                    hiddenValueOldProperty.FindPropertyRelative("b3").intValue = 0;
                    hiddenValueOldProperty.FindPropertyRelative("b4").intValue = 0;
                    hiddenValueOldProperty.FindPropertyRelative("b5").intValue = 0;
                    hiddenValueOldProperty.FindPropertyRelative("b6").intValue = 0;
                    hiddenValueOldProperty.FindPropertyRelative("b7").intValue = 0;
                    hiddenValueOldProperty.FindPropertyRelative("b8").intValue = 0;
                }

                fakeValue.doubleValue     = val;
                fakeValueActive.boolValue = true;
            }

            ResetBoldFont();
        }
Пример #15
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            var hiddenValue  = prop.FindPropertyRelative("hiddenValue");
            var hiddenValue1 = hiddenValue.FindPropertyRelative("b1");
            var hiddenValue2 = hiddenValue.FindPropertyRelative("b2");
            var hiddenValue3 = hiddenValue.FindPropertyRelative("b3");
            var hiddenValue4 = hiddenValue.FindPropertyRelative("b4");
            var hiddenValue5 = hiddenValue.FindPropertyRelative("b5");
            var hiddenValue6 = hiddenValue.FindPropertyRelative("b6");
            var hiddenValue7 = hiddenValue.FindPropertyRelative("b7");
            var hiddenValue8 = hiddenValue.FindPropertyRelative("b8");

            var hiddenValueOld = prop.FindPropertyRelative("hiddenValueOld");
            SerializedProperty hiddenValueOld1 = null;
            SerializedProperty hiddenValueOld2 = null;
            SerializedProperty hiddenValueOld3 = null;
            SerializedProperty hiddenValueOld4 = null;
            SerializedProperty hiddenValueOld5 = null;
            SerializedProperty hiddenValueOld6 = null;
            SerializedProperty hiddenValueOld7 = null;
            SerializedProperty hiddenValueOld8 = null;

            if (hiddenValueOld != null && hiddenValueOld.isArray && hiddenValueOld.arraySize == 8)
            {
                hiddenValueOld1 = hiddenValueOld.GetArrayElementAtIndex(0);
                hiddenValueOld2 = hiddenValueOld.GetArrayElementAtIndex(1);
                hiddenValueOld3 = hiddenValueOld.GetArrayElementAtIndex(2);
                hiddenValueOld4 = hiddenValueOld.GetArrayElementAtIndex(3);
                hiddenValueOld5 = hiddenValueOld.GetArrayElementAtIndex(4);
                hiddenValueOld6 = hiddenValueOld.GetArrayElementAtIndex(5);
                hiddenValueOld7 = hiddenValueOld.GetArrayElementAtIndex(6);
                hiddenValueOld8 = hiddenValueOld.GetArrayElementAtIndex(7);
            }

            SetBoldIfValueOverridePrefab(prop, hiddenValue);

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

            var currentCryptoKey = cryptoKey.longValue;

            var    union = new LongBytesUnion();
            double val   = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.longValue = ObscuredDouble.cryptoKeyEditor;
                }
                inited.boolValue = true;

                union.l = ObscuredDouble.Encrypt(0, currentCryptoKey);

                hiddenValue1.intValue = union.b8.b1;
                hiddenValue2.intValue = union.b8.b2;
                hiddenValue3.intValue = union.b8.b3;
                hiddenValue4.intValue = union.b8.b4;
                hiddenValue5.intValue = union.b8.b5;
                hiddenValue6.intValue = union.b8.b6;
                hiddenValue7.intValue = union.b8.b7;
                hiddenValue8.intValue = union.b8.b8;
            }
            else
            {
                if (hiddenValueOld != null && hiddenValueOld.isArray && hiddenValueOld.arraySize == 8)
                {
                    union.b8.b1 = (byte)hiddenValueOld1.intValue;
                    union.b8.b2 = (byte)hiddenValueOld2.intValue;
                    union.b8.b3 = (byte)hiddenValueOld3.intValue;
                    union.b8.b4 = (byte)hiddenValueOld4.intValue;
                    union.b8.b5 = (byte)hiddenValueOld5.intValue;
                    union.b8.b6 = (byte)hiddenValueOld6.intValue;
                    union.b8.b7 = (byte)hiddenValueOld7.intValue;
                    union.b8.b8 = (byte)hiddenValueOld8.intValue;
                }
                else
                {
                    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;
                }

                val = ObscuredDouble.Decrypt(union.l, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.DoubleField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                union.l = ObscuredDouble.Encrypt(val, currentCryptoKey);

                hiddenValue1.intValue = union.b8.b1;
                hiddenValue2.intValue = union.b8.b2;
                hiddenValue3.intValue = union.b8.b3;
                hiddenValue4.intValue = union.b8.b4;
                hiddenValue5.intValue = union.b8.b5;
                hiddenValue6.intValue = union.b8.b6;
                hiddenValue7.intValue = union.b8.b7;
                hiddenValue8.intValue = union.b8.b8;

                if (hiddenValueOld != null && hiddenValueOld.isArray && hiddenValueOld.arraySize == 8)
                {
                    hiddenValueOld.arraySize = 0;
                }
            }

            ResetBoldFont();
        }
Пример #16
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
            EditorGUI.LabelField(position, label.text + " [works in Unity 5+]");
#else
            SerializedProperty hiddenValue = prop.FindPropertyRelative("hiddenValue");
            SetBoldIfValueOverridePrefab(prop, hiddenValue);

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

            long currentCryptoKey = cryptoKey.longValue;

            LongBytesUnion union = new LongBytesUnion();
            double         val   = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.longValue = ObscuredDouble.cryptoKeyEditor;
                }
                hiddenValue.arraySize = 8;
                inited.boolValue      = true;

                union.l = ObscuredDouble.Encrypt(0, currentCryptoKey);

                hiddenValue.GetArrayElementAtIndex(0).intValue = union.b1;
                hiddenValue.GetArrayElementAtIndex(1).intValue = union.b2;
                hiddenValue.GetArrayElementAtIndex(2).intValue = union.b3;
                hiddenValue.GetArrayElementAtIndex(3).intValue = union.b4;
                hiddenValue.GetArrayElementAtIndex(4).intValue = union.b5;
                hiddenValue.GetArrayElementAtIndex(5).intValue = union.b6;
                hiddenValue.GetArrayElementAtIndex(6).intValue = union.b7;
                hiddenValue.GetArrayElementAtIndex(7).intValue = union.b8;
            }
            else
            {
                int    arraySize        = hiddenValue.arraySize;
                byte[] hiddenValueArray = new byte[arraySize];
                for (int i = 0; i < arraySize; i++)
                {
                    hiddenValueArray[i] = (byte)hiddenValue.GetArrayElementAtIndex(i).intValue;
                }

                union.b1 = hiddenValueArray[0];
                union.b2 = hiddenValueArray[1];
                union.b3 = hiddenValueArray[2];
                union.b4 = hiddenValueArray[3];
                union.b5 = hiddenValueArray[4];
                union.b6 = hiddenValueArray[5];
                union.b7 = hiddenValueArray[6];
                union.b8 = hiddenValueArray[7];

                val = ObscuredDouble.Decrypt(union.l, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.DoubleField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                union.l = ObscuredDouble.Encrypt(val, currentCryptoKey);

                hiddenValue.GetArrayElementAtIndex(0).intValue = union.b1;
                hiddenValue.GetArrayElementAtIndex(1).intValue = union.b2;
                hiddenValue.GetArrayElementAtIndex(2).intValue = union.b3;
                hiddenValue.GetArrayElementAtIndex(3).intValue = union.b4;
                hiddenValue.GetArrayElementAtIndex(4).intValue = union.b5;
                hiddenValue.GetArrayElementAtIndex(5).intValue = union.b6;
                hiddenValue.GetArrayElementAtIndex(6).intValue = union.b7;
                hiddenValue.GetArrayElementAtIndex(7).intValue = union.b8;
            }

            fakeValue.doubleValue = val;
            ResetBoldFont();
#endif
        }
Пример #17
0
 public void ErrorButton()
 {
     Time = 10;
 }