示例#1
0
 public void changecolor()
 {
     currentcolor = PlayerPrefsX.GetColor(PlayerPrefs.GetInt("Dropdown").ToString());
     sliderred.gameObject.GetComponent <Slider>().value   = (currentcolor.r) * 255;
     slidergreen.gameObject.GetComponent <Slider>().value = (currentcolor.g) * 255;
     sliderblue.gameObject.GetComponent <Slider>().value  = (currentcolor.b) * 255;
 }
示例#2
0
    //==========================================
    //PROFILES START AT 1, not 0. !!!!!!!!!!!!!!!!! dont forget this
    //This is the list the Profile manager will load on startup
    public static List <Profile> ProfileLoadList()
    {
        //Debug.Log("LOADING Profile List. . .");
        List <Profile> returnProfiles = new List <Profile> ();                                                                  //List that will be returned
        string         p = "Prof";                                                                                              //Used for string formats

        //cycles through saved data to find any existing profiles and add them to the return List<Profiles>
        for (int i = 1; i < maxProfiles; i++)
        {
            //String used for playerprefs profile Loading
            string profcheck = string.Format("{0}{1}", p, i.ToString());
            //Checking if the data exists, if yes make a new profile with the info and add it to the return list
            //checks if the player name exists, this is what all data checks will use
            if (PlayerPrefs.HasKey(profcheck + "Name"))
            {
                //Debug.Log(profcheck);				//just to check
                Profile tempProfile = new Profile();
                tempProfile.profileName   = PlayerPrefs.GetString(profcheck + "Name").ToString();               //name
                tempProfile.profileNumber = PlayerPrefs.GetInt(profcheck + "Number");                           //number
                tempProfile.zenCount      = PlayerPrefs.GetInt(profcheck + "ZenCount");                         //zen count
                tempProfile.profileColor  = PlayerPrefsX.GetColor(profcheck + "Color");                         //color
                returnProfiles.Add(tempProfile);
            }
        }
        if (returnProfiles.Count < 1)
        {
            // make the game loop through the initial profile creation... Shouldn't ever reach this code.
            Debug.Log("ERROR : No/ Missing Profile Data");
        }
        //Debug.Log ("PROFILE LENGTH: " + returnProfiles.Count);
        return(returnProfiles);
    }
示例#3
0
    void Awake()
    {
        carController = GetComponent <RCC_CarControllerV3>();

        defMaxSpeed = carController.maxspeed;
        defHandling = carController.highwaySteeringHelper;
        defMaxBrake = carController.highwayBrakingHelper;

        if (PlayerPrefs.HasKey(transform.name + "SelectedWheel"))
        {
            wheelIndex    = PlayerPrefs.GetInt(transform.name + "SelectedWheel", 0);
            selectedWheel = HR_Wheels.Instance.wheels[wheelIndex].wheel;
        }
        else
        {
            selectedWheel = null;
        }

        _speedLevel    = PlayerPrefs.GetInt(transform.name + "SpeedLevel");
        _handlingLevel = PlayerPrefs.GetInt(transform.name + "HandlingLevel");
        _brakeLevel    = PlayerPrefs.GetInt(transform.name + "BrakeLevel");

        bodyColor        = PlayerPrefsX.GetColor(transform.name + "BodyColor", HR_HighwayRacerProperties.Instance._defaultBodyColor);
        isSirenPurchased = PlayerPrefsX.GetBool(transform.name + "Siren", false);
        isSirenAttached  = PlayerPrefsX.GetBool(transform.name + "SirenAttached", false);

        isNOSPurchased   = PlayerPrefsX.GetBool(transform.name + "NOS", false);
        isTurboPurchased = PlayerPrefsX.GetBool(transform.name + "Turbo", false);
    }
示例#4
0
 public void SaveColor()
 {
     playClickSound();
     PlayerPrefsX.SetColor(PlayerPrefs.GetInt("Dropdown").ToString(), PlayerPrefsX.GetColor("CurrentColor"));
     anim.Play("OptTweenAnim_off");
     GamePanel.SetActive(false);
     MainOptionsPanel.SetActive(true);
     //play click sfx
 }
示例#5
0
 public void Color2()
 {
     SetColor1(PlayerPrefsX.GetColor("colorbody1"), "Body");
     if (PlayerPrefsX.GetColor("colorinterior1").a != 0)
     {
         SetColor1(PlayerPrefsX.GetColor("colorinterior1"), "Interior");
     }
     SetColor1(PlayerPrefsX.GetColor("colorwheels1"), "Wheels");
 }
    void Start()
    {
        // Load saved color
        Color savedColor = PlayerPrefsX.GetColor("_KeyCgCo");

        isPlayerPrefsLoaded = true;

        picker.CurrentColor = savedColor;
    }
        public override void OnEnter()
        {
            for (int i = 0; i < keys.Length; i++)
            {
                if (!keys[i].IsNone || !keys[i].Value.Equals(""))
                {
                    string key    = keys[i].Value;
                    FsmVar fsmVar = values[i];
                    string _name  = fsmVar.variableName;

                    switch (fsmVar.Type)
                    {
                    case VariableType.Int:
                        this.Fsm.Variables.GetFsmInt(_name).Value = PlayerPrefs.GetInt(key);
                        break;

                    case VariableType.Float:
                        this.Fsm.Variables.GetFsmFloat(_name).Value = PlayerPrefs.GetFloat(key);
                        break;

                    case VariableType.Bool:
                        this.Fsm.Variables.GetFsmBool(_name).Value = PlayerPrefsX.GetBool(key);
                        break;

                    case VariableType.Color:
                        this.Fsm.Variables.GetFsmColor(_name).Value = PlayerPrefsX.GetColor(key);
                        break;

                    case VariableType.Quaternion:
                        this.Fsm.Variables.GetFsmQuaternion(_name).Value = PlayerPrefsX.GetQuaternion(key);
                        break;

                    case VariableType.Rect:
                        this.Fsm.Variables.GetFsmRect(_name).Value = PlayerPrefsX.GetRect(key);
                        break;

                    case VariableType.Vector2:
                        this.Fsm.Variables.GetFsmVector2(_name).Value = PlayerPrefsX.GetVector2(key);
                        break;

                    case VariableType.Vector3:
                        this.Fsm.Variables.GetFsmVector3(_name).Value = PlayerPrefsX.GetVector3(key);
                        break;

                    case VariableType.String:
                        this.Fsm.Variables.GetFsmString(_name).Value = PlayerPrefs.GetString(key);
                        break;

                    default:
                        LogError("PlayerPrefsx does not support saving " + fsmVar.Type);
                        break;
                    }
                }
            }

            Finish();
        }
示例#8
0
    private void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();

        player1ActiveColor = PlayerPrefsX.GetColor("player1ActiveColor");
        player2ActiveColor = PlayerPrefsX.GetColor("player2ActiveColor");
        player1WinColor    = PlayerPrefsX.GetColor("player1WinColor");
        player2WinColor    = PlayerPrefsX.GetColor("player2WinColor");
    }
示例#9
0
    // Start is called before the first frame update
    public void LoadGame(string levelname)
    {
        SceneManager.LoadScene(levelname);
        int count = PlayerPrefs.GetInt("Count");

        game.Colors.Clear();
        for (int i = 0; i < count; i++)
        {
            game.Colors.Add(PlayerPrefsX.GetColor(i.ToString()));
        }
    }
示例#10
0
 void Start()
 {
     if (PlayerPrefs.GetInt("Count") == 0)
     {
         PlayerPrefs.SetInt("Count", 5);
     }
     counttext.text = PlayerPrefs.GetInt("Count").ToString();
     for (int i = 0; i < currentgamemode.Colors.Count; i++)
     {
         currentgamemode.Colors[i] = PlayerPrefsX.GetColor((i).ToString());
     }
 }
示例#11
0
 void Start()
 {
     if (PlayerPrefsX.GetColor(drop.value.ToString()) == color)
     {
         int     r = Random.Range(0, 256);
         int     g = Random.Range(0, 256);
         int     b = Random.Range(0, 256);
         Color32 x = new Color32((byte)r, (byte)g, (byte)b, 255);
         PlayerPrefsX.SetColor(drop.value.ToString(), x);
         drop.image.color = PlayerPrefsX.GetColor(drop.value.ToString());
     }
     else
     {
         drop.image.color = PlayerPrefsX.GetColor(drop.value.ToString());
     }
 }
示例#12
0
 // Update is called once per frame
 void Update()
 {
     if (PlayerPrefsX.GetColor(drop.value.ToString()) == color)
     {
         int     r = Random.Range(0, 256);
         int     g = Random.Range(0, 256);
         int     b = Random.Range(0, 256);
         Color32 x = new Color32((byte)r, (byte)g, (byte)b, 255);
         PlayerPrefsX.SetColor(drop.value.ToString(), x);
         drop.image.color = PlayerPrefsX.GetColor(drop.value.ToString());
         PlayerPrefs.SetInt("CurrentDropValue", drop.value);
     }
     else
     {
         drop.image.color = PlayerPrefsX.GetColor(drop.value.ToString());
     }
 }
示例#13
0
    public void CreateGrid()
    {
        AddGap();
        CalcStartPos();

        gridHolder = new GameObject("Grid").transform;

        for (int y = 0; y < gridHeight; y++)
        {
            for (int x = 0; x < gridWidth; x++)
            {
                Transform tile    = Instantiate(hexPrefab) as Transform;
                Vector2   gridPos = new Vector2(x, y);
                // Move to the correct location
                tile.position = CalcWorldPos(gridPos);
                // Set the parent to the grid for neatness
                tile.transform.SetParent(gridHolder);

                Hexagon hex = tile.GetComponent <Hexagon>();
                hex.x = x;
                hex.y = y;
                GameManager.instance.hex[x, y] = hex;
            }
        }

        // Style the borders
        GameObject[] player1Borders = GameObject.FindGameObjectsWithTag("Player 1 Border");
        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < player1Borders[i].transform.childCount; j++)
            {
                Transform c = player1Borders[i].transform.GetChild(j);
                c.GetComponent <SpriteRenderer>().color = PlayerPrefsX.GetColor("player1WinColor");
            }
        }
        GameObject[] player2Borders = GameObject.FindGameObjectsWithTag("Player 2 Border");
        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < player2Borders[i].transform.childCount; j++)
            {
                Transform c = player2Borders[i].transform.GetChild(j);
                c.GetComponent <SpriteRenderer>().color = PlayerPrefsX.GetColor("player2WinColor");
            }
        }
    }
示例#14
0
    //used for setting up the very first profile for the app
    public static void InitialProfileSetup()
    {
        Debug.Log("INITIAL SETUP: Profile 1. . .");
        PlayerPrefs.SetString("PROFILES", "0");          //this is just used for checking if they have profile data, dont worry about the string its saving
        string p         = "Prof";
        string profcheck = string.Format("{0}{1}", p, "1");

        Profile initialProfile = new Profile();

        //initial setup of variabels
        PlayerPrefs.SetString(profcheck + "Name", "DEFAULT");                                           //name
        PlayerPrefs.SetInt(profcheck + "Number", 1);                                                    //number
        PlayerPrefs.SetInt(profcheck + "ZenCount", 0);                                                  //zen count
        PlayerPrefsX.SetColor(profcheck + "Color", Color.white);                                        //color

        initialProfile.profileName   = PlayerPrefs.GetString(profcheck + "Name").ToString();            //name
        initialProfile.profileNumber = PlayerPrefs.GetInt(profcheck + "Number");                        //number
        initialProfile.profileColor  = PlayerPrefsX.GetColor(profcheck + "Color");                      //color
    }
    // restores all savestate data and replaces instance vars accordingly
    public void LoadPrefs()
    {
        if (PlayerPrefs.HasKey("firststart"))
        {
            intro.SetActive(false);
            user = new User(PlayerPrefs.GetString("user_gender"), PlayerPrefs.GetInt("user_age"),
                            PlayerPrefs.GetInt("user_height"), PlayerPrefs.GetInt("user_weight"),
                            PlayerPrefs.GetInt("user_lvl"), PlayerPrefs.GetInt("user_totalXP"));
            AddXP(0); //add 0 XP to restore progressbar position
            lvlLabel.text = "[Level " + user.lvl + "]";
            //deserialize json-string into workoutHistory-dict and restore it
            var dWorkoutHistory = JsonConvert.DeserializeObject <Dictionary <DateTime, List <WorkoutSession> > >(PlayerPrefs.GetString("workoutHistory"));
            workoutHistory = dWorkoutHistory;

            Color mainColor = PlayerPrefsX.GetColor("mainColor");
            Color bgColor   = PlayerPrefsX.GetColor("bgColor");

            GameObject.FindGameObjectWithTag("Camera").GetComponent <Camera>().backgroundColor = bgColor;
            GameObject[] bgos = GameObject.FindGameObjectsWithTag("BGColor");
            foreach (GameObject go in bgos)
            {
                go.GetComponent <UnityEngine.UI.Image>().color = bgColor;
            }
            GameObject[] gos = GameObject.FindGameObjectsWithTag("Header");
            foreach (GameObject go in gos)
            {
                go.GetComponent <UnityEngine.UI.Image>().color = mainColor;
            }
            mainCol = mainColor; bgCol = bgColor;

            NotificationTimer.h = PlayerPrefs.GetInt("notification_h");
            NotificationTimer.m = PlayerPrefs.GetInt("notification_m");
            NotificationTimer.SetupLocalNotificationsOnReboot(NotificationTimer.h, NotificationTimer.m, 7);
            //unlock all currently unlocked rewards again
            LevelRewards.UnlockLevelRewards();
        }
        else
        {
            intro.SetActive(true);
        }
    }
示例#16
0
    /// <summary>
    /// Load all stats with PlayerPrefs.
    /// </summary>
    public static void LoadStats(RCC_CarControllerV3 car)
    {
        SetFrontCambers(car, PlayerPrefs.GetFloat(car.transform.name + "_FrontCamber", car.FrontLeftWheelCollider.camber));
        SetRearCambers(car, PlayerPrefs.GetFloat(car.transform.name + "_RearCamber", car.RearLeftWheelCollider.camber));

        SetFrontSuspensionsDistances(car, PlayerPrefs.GetFloat(car.transform.name + "_FrontSuspensionsDistance", car.FrontLeftWheelCollider.wheelCollider.suspensionDistance));
        SetRearSuspensionsDistances(car, PlayerPrefs.GetFloat(car.transform.name + "_RearSuspensionsDistance", car.RearLeftWheelCollider.wheelCollider.suspensionDistance));

        SetFrontSuspensionsSpringForce(car, PlayerPrefs.GetFloat(car.transform.name + "_FrontSuspensionsSpring", car.FrontLeftWheelCollider.wheelCollider.suspensionSpring.spring));
        SetRearSuspensionsSpringForce(car, PlayerPrefs.GetFloat(car.transform.name + "_RearSuspensionsSpring", car.RearLeftWheelCollider.wheelCollider.suspensionSpring.spring));

        SetFrontSuspensionsSpringDamper(car, PlayerPrefs.GetFloat(car.transform.name + "_FrontSuspensionsDamper", car.FrontLeftWheelCollider.wheelCollider.suspensionSpring.damper));
        SetRearSuspensionsSpringDamper(car, PlayerPrefs.GetFloat(car.transform.name + "_RearSuspensionsDamper", car.RearLeftWheelCollider.wheelCollider.suspensionSpring.damper));

        SetMaximumSpeed(car, PlayerPrefs.GetFloat(car.transform.name + "_MaximumSpeed", car.maxspeed));
        SetMaximumBrake(car, PlayerPrefs.GetFloat(car.transform.name + "_MaximumBrake", car.brakeTorque));
        SetMaximumTorque(car, PlayerPrefs.GetFloat(car.transform.name + "_MaximumTorque", car.engineTorque));

        string drvtrn = PlayerPrefs.GetString(car.transform.name + "_DrivetrainMode", car._wheelTypeChoise.ToString());

        switch (drvtrn)
        {
        case "FWD":
            car._wheelTypeChoise = RCC_CarControllerV3.WheelType.FWD;
            break;

        case "RWD":
            car._wheelTypeChoise = RCC_CarControllerV3.WheelType.RWD;
            break;

        case "AWD":
            car._wheelTypeChoise = RCC_CarControllerV3.WheelType.AWD;
            break;
        }

        SetGearShiftingThreshold(car, PlayerPrefs.GetFloat(car.transform.name + "_GearShiftingThreshold", car.gearShiftingThreshold));
        SetClutchThreshold(car, PlayerPrefs.GetFloat(car.transform.name + "_ClutchingThreshold", car.clutchInertia));

        SetCounterSteering(car, PlayerPrefsX.GetBool(car.transform.name + "_CounterSteering", car.applyCounterSteering));

        SetABS(car, PlayerPrefsX.GetBool(car.transform.name + "_ABS", car.ABS));
        SetESP(car, PlayerPrefsX.GetBool(car.transform.name + "_ESP", car.ESP));
        SetTCS(car, PlayerPrefsX.GetBool(car.transform.name + "_TCS", car.TCS));
        SetSH(car, PlayerPrefsX.GetBool(car.transform.name + "_SH", car.steeringHelper));

        SetNOS(car, PlayerPrefsX.GetBool(car.transform.name + "NOS", car.useNOS));
        SetTurbo(car, PlayerPrefsX.GetBool(car.transform.name + "Turbo", car.useTurbo));
        SetUseExhaustFlame(car, PlayerPrefsX.GetBool(car.transform.name + "ExhaustFlame", car.useExhaustFlame));
        SetSteeringSensitivity(car, PlayerPrefsX.GetBool(car.transform.name + "SteeringSensitivity", car.steerAngleSensitivityAdjuster));
        SetRevLimiter(car, PlayerPrefsX.GetBool(car.transform.name + "RevLimiter", car.useRevLimiter));
        SetClutchMargin(car, PlayerPrefsX.GetBool(car.transform.name + "ClutchMargin", car.useClutchMarginAtFirstGear));

        if (PlayerPrefs.HasKey(car.transform.name + "_WheelsSmokeColor"))
        {
            SetSmokeColor(car, 0, PlayerPrefsX.GetColor(car.transform.name + "_WheelsSmokeColor"));
        }

        if (PlayerPrefs.HasKey(car.transform.name + "_HeadlightsColor"))
        {
            SetHeadlightsColor(car, PlayerPrefsX.GetColor(car.transform.name + "_HeadlightsColor"));
        }

        UpdateRCC(car);
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void Awake()
    {
        AudioListener.pause = false;
        Time.timeScale      = 1.0f;


        menuGUI.vibrateToggle.isOn = (PlayerPrefs.GetInt("VibrationActive") == 0) ? true : false;


        gameScore = 999999;
        CurrentPanel(0);

        if (PlayerPrefs.GetInt("QualitySettings") == 0)
        {
            PlayerPrefs.SetInt("QualitySettings", 4);
            QualitySettings.SetQualityLevel(3, true);
        }
        else
        {
            QualitySettings.SetQualityLevel(PlayerPrefs.GetInt("QualitySettings") - 1, true);
        }

        if (PlayerPrefs.GetFloat("Sensitivity") == 0.0f)
        {
            menuGUI.sensitivity.value = 1.0f;
            PlayerPrefs.SetFloat("Sensitivity", 1.0f);
        }
        else
        {
            menuGUI.sensitivity.value = PlayerPrefs.GetFloat("Sensitivity");
        }


        switch (PlayerPrefs.GetString("ControlMode"))
        {
        case "":
            menuGUI.ButtonMode.isOn = true;
            break;

        case "Buttons":
            menuGUI.ButtonMode.isOn = true;
            break;

        case "Accel":
            menuGUI.AccelMode.isOn = true;
            break;
        }


        currentLevelNumber = PlayerPrefs.GetInt("CurrentLevelNumber");

        for (int lvls = 0; lvls < levelSetting.Length; lvls++)
        {
            if (lvls <= PlayerPrefs.GetInt("CurrentLevelUnlocked"))
            {
                levelSetting[lvls].locked = false;
            }
        }


        currentLevel(currentLevelNumber);


        switch (PlayerPrefs.GetString("ControlMode"))
        {
        case "":
            PlayerPrefs.SetString("ControlMode", "Buttons");
            menuGUI.ButtonMode.isOn = true;
            break;

        case "Buttons":
            menuGUI.ButtonMode.isOn = true;
            break;

        case "Accel":
            menuGUI.AccelMode.isOn = true;
            break;
        }


        PlayerPrefs.SetInt("BoughtVehicle0", 1);


        //audio and music Toggle
        menuGUI.audio.isOn   = (PlayerPrefs.GetInt("AudioActive") == 0) ? true : false;
        AudioListener.volume = (PlayerPrefs.GetInt("AudioActive") == 0) ? 1.0f : 0.0f;

        menuGUI.music.isOn = (PlayerPrefs.GetInt("MusicActive") == 0) ? true : false;
        menuMusic.mute     = (PlayerPrefs.GetInt("MusicActive") == 0) ? false : true;

        currentVehicleNumber = PlayerPrefs.GetInt("CurrentVehicle");
        currentVehicle       = vehicleSetting[currentVehicleNumber];


        int i = 0;

        foreach (VehicleSetting VSetting in vehicleSetting)
        {
            if (PlayerPrefsX.GetColor("VehicleWheelsColor" + i) == Color.clear)
            {
                vehicleSetting[i].ringMat.SetColor("_DiffuseColor", Color.white);
            }
            else
            {
                vehicleSetting[i].ringMat.SetColor("_DiffuseColor", PlayerPrefsX.GetColor("VehicleWheelsColor" + i));
            }



            if (PlayerPrefsX.GetColor("VehicleSmokeColor" + i) == Color.clear)
            {
                vehicleSetting[i].smokeMat.SetColor("_TintColor", new Color(0.8f, 0.8f, 0.8f, 0.2f));
            }
            else
            {
                vehicleSetting[i].smokeMat.SetColor("_TintColor", PlayerPrefsX.GetColor("VehicleSmokeColor" + i));
            }



            if (PlayerPrefs.GetInt("BoughtVehicle" + i.ToString()) == 1)
            {
                VSetting.Bought = true;

                if (PlayerPrefs.GetInt("GameScore") == 0)
                {
                    PlayerPrefs.SetInt("GameScore", gameScore);
                }
                else
                {
                    gameScore = PlayerPrefs.GetInt("GameScore");
                }
            }


            if (VSetting == vehicleSetting[currentVehicleNumber])
            {
                VSetting.vehicle.SetActive(true);
                currentVehicle = VSetting;
            }
            else
            {
                VSetting.vehicle.SetActive(false);
            }

            i++;
        }
    }
示例#18
0
 public static Color GetMatColor()
 {
     return(PlayerPrefsX.GetColor(MAT_COLOR));
 }