Ejemplo n.º 1
0
    public SecureFloat(float _float)
    {
        byte[] bs = System.BitConverter.GetBytes(_float);
        int    i  = System.BitConverter.ToInt32(bs, 0);

        m_value = new SecureInt(i);
    }
Ejemplo n.º 2
0
        public void UnlockedLevel(int numberLevel)
        {
            IsActiveLevel(true);

            _numberLevel         = numberLevel;
            _tmpNumberLevel.text = _numberLevel.ToString();
        }
Ejemplo n.º 3
0
    public static SecureInt operator -(SecureInt d1, SecureInt d2)
    {
        SecureInt res = new SecureInt();

        res.SetValue(d1.GetValue() - d2.GetValue());
        return(res);
    }
Ejemplo n.º 4
0
        public TaskLevel(DataTask dataTask, TaskDisplay taskDisplayer)
        {
            this._taskDisplayer = taskDisplayer;
            taskDisplayer.SetInfo(dataTask);

            _taskChecking = TaskCheckingInitializer.GetTaskCheking(dataTask.TypeTask);

            _countTask = dataTask.Count;
        }
Ejemplo n.º 5
0
        public void Init(int newValue, bool isActivTap = false)
        {
            Value = newValue;
            _tmpCountMoves.text = Value.ToString();

            if (isActivTap)
            {
                _boardTapController.IsCanTap = true;
            }
        }
 public void SetSecure(string key, int value)
 {
     if (secureDict == null) secureDict = new Dictionary<string, SecureInt>();
     SecureInt o;
     if (secureDict.TryGetValue(key, out o))
     {
         o.Get();
         o.Set(value);
     }
     else
         secureDict[key] = new SecureInt(key, value);
 }
 public int GetSecure(string key, int def = 0)
 {
     if (secureDict == null) secureDict = new Dictionary<string, SecureInt>();
     SecureInt o;
     if (secureDict.TryGetValue(key, out o))
         return o.Get();
     else
     {
         secureDict[key] = new SecureInt(key, def);
         return def;
     }
 }
    public void SetSecure(string key, int value)
    {
        if (secureDict == null)
        {
            secureDict = new Dictionary <string, SecureInt>();
        }
        SecureInt o;

        if (secureDict.TryGetValue(key, out o))
        {
            o.Get();
            o.Set(value);
        }
        else
        {
            secureDict[key] = new SecureInt(key, value);
        }
    }
    public int GetSecure(string key, int def = 0)
    {
        if (secureDict == null)
        {
            secureDict = new Dictionary <string, SecureInt>();
        }
        SecureInt o;

        if (secureDict.TryGetValue(key, out o))
        {
            return(o.Get());
        }
        else
        {
            secureDict[key] = new SecureInt(key, def);
            return(def);
        }
    }
    public void Start()
    {
        AutoQuality.InitSkybox();
        foreach (GUITexture a in FindObjectsOfType(typeof(GUITexture)))
            if (a != _Loader.fullScreen)
            {
                var rr = a.pixelInset;
                rr.width = (int)rr.width * Screen.width / 800f;
                rr.height = (int)rr.height * Screen.width / 800f;
                a.pixelInset = rr;
            }
        LogEvent("!CarSelect");
        win.ShowWindow(Window, null, true);
        car = _Loader.carSkin == -1 ? 0 : _Loader.carSkin;
        sPos = car;
        LoadSkin();
        camRot = cam.eulerAngles;
        //camera = Camera.main;

        StartCoroutine(_AutoQuality.OnLevelWasLoaded2(0));
        //_Loader.ShowWindow(CarSelectWindow);
    }
    public void Start()
    {
        AutoQuality.InitSkybox();
        foreach (GUITexture a in FindObjectsOfType(typeof(GUITexture)))
        {
            if (a != _Loader.fullScreen)
            {
                var rr = a.pixelInset;
                rr.width     = (int)rr.width * Screen.width / 800f;
                rr.height    = (int)rr.height * Screen.width / 800f;
                a.pixelInset = rr;
            }
        }
        LogEvent("!CarSelect");
        win.ShowWindow(Window, null, true);
        car  = _Loader.carSkin == -1 ? 0 : _Loader.carSkin;
        sPos = car;
        LoadSkin();
        camRot = cam.eulerAngles;
        //camera = Camera.main;

        StartCoroutine(_AutoQuality.OnLevelWasLoaded2(0));
        //_Loader.ShowWindow(CarSelectWindow);
    }
Ejemplo n.º 12
0
        public void Tests()
        {
            SecureShort  secureShort  = new SecureShort(500);
            SecureInt    secureInt    = new SecureInt(100000);
            SecureLong   secureLong   = new SecureLong(10000000000);
            SecureFloat  secureFloat  = new SecureFloat(123.456789f);
            SecureDouble secureDouble = new SecureDouble(123.456789d);
            SecureString secureString = new SecureString("secure");

            Assert.IsTrue(secureShort == 500);
            Assert.IsTrue(secureInt == 100000);
            Assert.IsTrue(secureLong == 10000000000);
            Assert.IsTrue(secureFloat == 123.456789f);
            Assert.IsTrue(secureDouble == 123.456789d);
            Assert.IsTrue(secureString == "secure");
            Assert.IsTrue(new SecureVec2(new Vec2(10f, 10f)) == new Vec2(10f, 10f));
            Assert.IsTrue(new SecureVec3(new Vec3(10f, 10f, 10f)) == new Vec3(10f, 10f, 10f));
            Assert.IsTrue(new SecureVec4(new Vec4(10f, 10f, 10f, 10f)) == new Vec4(10f, 10f, 10f, 10f));

            secureInt.Set(123);
            secureString.Set("network");
            Assert.IsTrue(secureInt == 123);
            Assert.IsTrue(secureString == "network");
        }
Ejemplo n.º 13
0
    IEnumerator UpdateScore()
    {
        while (true)
        {
            //yield return new WaitForSeconds(1);
            yield return(null);

            if (gameOver)
            {
                break;
            }
            else
            {
                scoreF += currentMultiplier * Time.deltaTime;
                if (scoreF - (int)scoreF > 1 + currentMultiplier)
                {
                    Debug.LogError("Cheat detected");
                    scoreF = 0;
                }
                score          = (int)scoreF;
                scoreText.text = ((int)score).ToString("D5");
            }
        }
    }
Ejemplo n.º 14
0
 public void SetDeaths(int i)
 {
     deaths = i;
 }
Ejemplo n.º 15
0
 public void SetKills(int i)
 {
     kills = i;
 }
Ejemplo n.º 16
0
 private void Buy(int price, bool isSave)
 {
     Value -= price;
     OnSaveData(isSave);
 }
Ejemplo n.º 17
0
 public void AddCoins(int countCoins, bool isSave = true)
 {
     Value += countCoins;
     OnSaveData(isSave);
 }
Ejemplo n.º 18
0
 public void Init(int coins, Action <bool> saveData)
 {
     Value      = coins;
     OnSaveData = saveData;
 }
    public void Window()
    {
        win.Setup(350, 600, " ", Dock.Right);
        BeginScrollView();
        //if (gui.Button("Paint Car"))
        //{
        //    paintTexture = new Texture2D(1024, 1024);
        //    paintCar = true;
        //    var renderers = carModel.GetComponentsInChildren<MeshRenderer>();
        //    foreach (MeshRenderer r in renderers)
        //    {
        //        var m = r.material.mainTexture;
        //        var mesh = r.GetComponent<MeshFilter>().mesh;
        //        print("UVS");
        //        print(mesh.uv.Length);
        //        print(mesh.uv2.Length);
        //        mesh.uv = mesh.uv2.ToArray();
        //        r.gameObject.AddComponent<MeshCollider>();
        //        r.material.mainTexture = paintTexture;
        //    }
        //    //Texture2D txt = new Texture2D();
        //}
        //gui.Label(_Loader.Avatar);
        gui.BeginHorizontal();
        if (gui.Button(_Loader.Avatar, skin.label))
        {
            ShowWindow(_Loader.SelectAvatar, Window);
        }
        gui.BeginVertical();
        if (isDebug && Button("Profile"))
        {
            ShowWindowNoBack(ProfileWindow);
        }
        gui.EndVertical();
        gui.EndHorizontal();
        gui.Label(_Loader.playerName.ToUpper());

        gui.BeginHorizontal();
        //if(Math.Abs(old - posx) < .005f)
        var prev = Button("<Prev");

        if (prev || Button("Next>"))
        {
            var i = prev ? -1 : 1;
            while (true)
            {
                car += i;
                if (!_Loader.GetCarSkin(CarId, true).hidden || _Loader.tester)
                {
                    break;
                }
            }
        }
        gui.EndHorizontal();

        if (isDebug && Button("Select"))
        {
            _Loader.carSkin = CarId;
            LoadLevel(Levels.menu);
        }
        if (!locked)
        {
            if (!carSkin.repUnlocked && !_Loader.disableRep)
            {
                skin.label.wordWrap = true;
                if (_Loader.reputation < carSkin.repNeeded)
                {
                    gui.Label(new GUIContent(string.Format(Tr("You need {0} reputation points to unlock this car"), carSkin.repNeeded), win.reputation));
                }
                else
                {
                    gui.Label(new GUIContent(string.Format(Tr("Price: {0} reputation points"), carSkin.repNeeded), win.reputation));
                    if (Button("Buy this car"))
                    {
                        BuyWindow(delegate
                        {
                            carSkin.repUnlocked = true;
                        }, carSkin.repNeeded, Tr("car"));
                    }
                }
            }
            else
            {
                if (ButtonTexture(Tr(locked ? "Locked" : "Select"), locked ? lockedIcon : selectIcon, 60) && !locked)
                {
                    _Loader.carSkin = CarId;
                    LoadLevel(Levels.menu);
                }
                if (car == 0 && Button("Change Skin"))
                {
                    _Loader.Country++;
                    _Loader.Country =
                        (CountryCodes)((int)_Loader.Country % Enum.GetValues(typeof(CountryCodes)).Length);
                    Player.SetFlag(carModel, _Loader.Country);
                }
                if (carSkin.canPickColor && medium && Button("Pick Color"))
                {
                    BuyWindow(delegate { carSkin.paintUnlocked = true; ShowWindow(MaterialPick, Window); }, 15, Tr("Pick Color"), carSkin.paintUnlocked || _Loader.disableRep);
                }
            }
        }
        else
        {
            skin.label.wordWrap = true;
            gui.Label(new GUIContent(lockedTxt.text, lockedIcon));
        }
        if (!locked && carSkin != null)
        {
            skin.label.alignment = TextAnchor.UpperLeft;
            //skin.label.wordWrap = false;
            gui.Label(new GUIContent(Tr("Top Speed"), res.rating[(carSkin.TopSpeed + 1) * 2]));
            gui.Label(new GUIContent(Tr("Acceleration"), res.rating[(carSkin.Speed + 1) * 2]));
            gui.Label(new GUIContent(Tr("Handling"), res.rating[(carSkin.Rotation + 1) * 2]));
            gui.Label(new GUIContent(Tr("Drift"), res.rating[(carSkin.Drift + 1) * 2]));
            //gui.Label(new GUIContent(Tr("Mass"), res.rating[(carSkin.mass+ 1) * 2]));
        }
        if (input.GetKeyDown(KeyCode.Escape) || Button("Exit")) //
        {
            Cancel();
        }
        if (Button(_Loader.medals + Trs(" medals"), false, 20, false, win.medalsCnt))
        {
            Popup("medaltext", win.medalsCnt);
        }
        if (!_Loader.disableRep)
        {
            if (Button(_Loader.reputation + Trs(" Reputation"), false, 20, false, win.reputation))
            {
                Popup("reptext", win.reputation);
            }
        }

        gui.EndScrollView();
    }
    public void Window()
    {
        win.Setup(350, 600, " ", Dock.Right);
        BeginScrollView();
        //if (gui.Button("Paint Car"))
        //{
        //    paintTexture = new Texture2D(1024, 1024);
        //    paintCar = true;
        //    var renderers = carModel.GetComponentsInChildren<MeshRenderer>();
        //    foreach (MeshRenderer r in renderers)
        //    {
        //        var m = r.material.mainTexture;
        //        var mesh = r.GetComponent<MeshFilter>().mesh;
        //        print("UVS");
        //        print(mesh.uv.Length);
        //        print(mesh.uv2.Length);
        //        mesh.uv = mesh.uv2.ToArray();
        //        r.gameObject.AddComponent<MeshCollider>();
        //        r.material.mainTexture = paintTexture;
        //    }
        //    //Texture2D txt = new Texture2D();
        //}
        //gui.Label(_Loader.Avatar);
        gui.BeginHorizontal();
        if (gui.Button(_Loader.Avatar, skin.label))
            ShowWindow(_Loader.SelectAvatar, Window);
        gui.BeginVertical();
        if (isDebug && Button("Profile"))
        {
            ShowWindowNoBack(ProfileWindow);
        }
        gui.EndVertical();
        gui.EndHorizontal();
        gui.Label(_Loader.playerName.ToUpper());

        gui.BeginHorizontal();
        //if(Math.Abs(old - posx) < .005f)
        var prev = Button("<Prev");
        if (prev || Button("Next>"))
        {
            var i = prev ? -1 : 1;
            while (true)
            {
                car += i;
                if (!_Loader.GetCarSkin(CarId, true).hidden || _Loader.tester)
                    break;
            }
        }
        gui.EndHorizontal();

        if (isDebug && Button("Select"))
        {
            _Loader.carSkin = CarId;
            LoadLevel(Levels.menu);
        }
        if (!locked)
        {
            if (!carSkin.repUnlocked && !_Loader.disableRep)
            {
                skin.label.wordWrap = true;
                if (_Loader.reputation < carSkin.repNeeded) 
                {
                    gui.Label(new GUIContent(string.Format(Tr("You need {0} reputation points to unlock this car"), carSkin.repNeeded), win.reputation)); 
                }
                else
                {
                    gui.Label(new GUIContent(string.Format(Tr("Price: {0} reputation points"), carSkin.repNeeded), win.reputation));
                    if (Button("Buy this car"))
                    {
                        BuyWindow(delegate
                        {
                            carSkin.repUnlocked = true;
                        }, carSkin.repNeeded, Tr("car"));

                    }
                }
            }
            else
            {
                if (ButtonTexture(Tr(locked ? "Locked" : "Select"), locked ? lockedIcon : selectIcon, 60) && !locked)
                {
                    _Loader.carSkin = CarId;
                    LoadLevel(Levels.menu);
                }
                if (car == 0 && Button("Change Skin"))
                {
                    _Loader.Country++;
                    _Loader.Country =
                        (CountryCodes) ((int) _Loader.Country%Enum.GetValues(typeof (CountryCodes)).Length);
                    Player.SetFlag(carModel, _Loader.Country);
                }
                if (carSkin.canPickColor && medium && Button("Pick Color"))
                    BuyWindow(delegate { carSkin.paintUnlocked = true; ShowWindow(MaterialPick, Window); }, 15, Tr("Pick Color"), carSkin.paintUnlocked || _Loader.disableRep);
            }
        }
        else
        {
            skin.label.wordWrap = true;
            gui.Label(new GUIContent(lockedTxt.text,lockedIcon));
        }
        if (!locked && carSkin != null)
        {
            skin.label.alignment = TextAnchor.UpperLeft;
            //skin.label.wordWrap = false;
            gui.Label(new GUIContent(Tr("Top Speed"), res.rating[(carSkin.TopSpeed + 1) * 2]));
            gui.Label(new GUIContent(Tr("Acceleration"), res.rating[(carSkin.Speed + 1) * 2]));
            gui.Label(new GUIContent(Tr("Handling"), res.rating[(carSkin.Rotation + 1) * 2]));
            gui.Label(new GUIContent(Tr("Drift"), res.rating[(carSkin.Drift + 1) * 2]));
            //gui.Label(new GUIContent(Tr("Mass"), res.rating[(carSkin.mass+ 1) * 2]));
        }
        if (input.GetKeyDown(KeyCode.Escape) || Button("Exit")) //
            Cancel();
        if (Button(_Loader.medals + Trs(" medals"), false, 20, false, win.medalsCnt))
            Popup("medaltext", win.medalsCnt);
        if (!_Loader.disableRep)
            if (Button(_Loader.reputation + Trs(" Reputation"), false, 20, false, win.reputation))
                Popup("reptext", win.reputation);
        
        gui.EndScrollView();
    }
Ejemplo n.º 21
0
 public int CompareTo(SecureInt _s)
 {
     return(V.CompareTo(_s.V));
 }