Esempio n. 1
0
    //==========================================================Profile saving

    private void SaveProfile(string n_name, int n_number, Color n_color)
    {
        //check if the profile number doesn't conflict, save that shit
        if (n_number == 1)
        {
            ProfileData.InitialProfileSetup();
        }
        string p         = "Prof";
        string profcheck = string.Format("{0}{1}", p, n_number.ToString());             //should save it to the n_number value profile


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

        //------
//		these values are just in case, future animation possibly?

//		Profile tempProfile = new Profile ();
//		tempProfile.profileName = PlayerPrefs.GetString (profcheck + "Name");				//name get
//		tempProfile.profileNumber = PlayerPrefs.GetInt (profcheck + "Number");				//number get
//		tempProfile.zenCount = PlayerPrefs.GetInt (profcheck + "ZenCount")					//zen count get
//		tempProfile.profileColor = PlayerPrefsX.GetColor (profcheck + "Color");				//color get

        Debug.Log("SAVING PROFILE #" + n_number.ToString() + " . . .");

        OnSaveComplete();
    }
Esempio n. 2
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
 }
Esempio n. 3
0
    public void UpdateStats()
    {
        carController.maxspeed = Mathf.Lerp(defMaxSpeed, maxUpgradeSpeed, _speedLevel / 5f);
        carController.highwaySteeringHelper = Mathf.Lerp(defHandling, maxUpgradeHandling, _handlingLevel / 5f);
        carController.highwayBrakingHelper  = Mathf.Lerp(defMaxBrake, maxUpgradeBrake, _brakeLevel / 5f);

        if (bodyRenderer)
        {
            bodyRenderer.sharedMaterials[materialIndex].color = bodyColor;
        }
        //		else
        //			Debug.LogError("Missing Body Renderer On ModApllier Component");

        if (isSirenPurchased && !attachedFrontSiren)
        {
            CreateSiren();
        }

        if (isNOSPurchased)
        {
            carController.useNOS = true;
        }
        else
        {
            carController.useNOS = false;
        }

        if (isTurboPurchased)
        {
            carController.useTurbo = true;
        }
        else
        {
            carController.useTurbo = false;
        }

        if (selectedWheel)
        {
            ChangeWheels(carController, selectedWheel);

            carController.FrontLeftWheelCollider.wheelCollider.radius  = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform);
            carController.FrontRightWheelCollider.wheelCollider.radius = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform);
            carController.RearLeftWheelCollider.wheelCollider.radius   = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform);
            carController.RearRightWheelCollider.wheelCollider.radius  = RCC_GetBounds.MaxBoundsExtent(selectedWheel.transform);

            PlayerPrefs.SetInt(transform.name + "SelectedWheel", wheelIndex);
        }

        PlayerPrefs.SetInt(transform.name + "SpeedLevel", _speedLevel);
        PlayerPrefs.SetInt(transform.name + "HandlingLevel", _handlingLevel);
        PlayerPrefs.SetInt(transform.name + "BrakeLevel", _brakeLevel);
        PlayerPrefsX.SetColor(transform.name + "BodyColor", bodyColor);
        PlayerPrefsX.SetBool(transform.name + "Siren", isSirenPurchased);
        PlayerPrefsX.SetBool(transform.name + "NOS", isNOSPurchased);
        PlayerPrefsX.SetBool(transform.name + "Turbo", isTurboPurchased);
    }
        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];

                    switch (fsmVar.Type)
                    {
                    case VariableType.Int:
                        PlayerPrefs.SetInt(key, fsmVar.IsNone ? 0 : (int)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Float:
                        PlayerPrefs.SetFloat(key, fsmVar.IsNone ? 0f : (float)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Bool:
                        PlayerPrefsX.SetBool(key, fsmVar.IsNone ? false : (bool)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Color:
                        PlayerPrefsX.SetColor(key, fsmVar.IsNone ? Color.black : (Color)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Quaternion:
                        PlayerPrefsX.SetQuaternion(key, fsmVar.IsNone ? Quaternion.identity : (Quaternion)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Rect:
                        PlayerPrefsX.SetRect(key, fsmVar.IsNone ? new Rect(0f, 0f, 0f, 0f) : (Rect)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Vector2:
                        PlayerPrefsX.SetVector2(key, fsmVar.IsNone ? Vector2.zero : (Vector2)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Vector3:
                        PlayerPrefsX.SetVector3(key, fsmVar.IsNone ? Vector3.zero : (Vector3)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.String:
                        PlayerPrefs.SetString(key, fsmVar.IsNone ? "" : (string)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

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

            Finish();
        }
Esempio n. 5
0
    // Update is called once per frame
    void Update()
    {
        int     r = (int)sliderred.gameObject.GetComponent <Slider>().value;
        int     g = (int)slidergreen.gameObject.GetComponent <Slider>().value;
        int     b = (int)sliderblue.gameObject.GetComponent <Slider>().value;
        Color32 a = new Color32((byte)r, (byte)g, (byte)b, 255);

        square.gameObject.GetComponent <Image>().color = a;
        PlayerPrefsX.SetColor("CurrentColor", a);
    }
Esempio n. 6
0
    public void SaveColor1()
    {
        PlayerPrefsX.SetColor("colorbody", bodyColor);
        PlayerPrefsX.SetColor("colorinterior", interiorColor);
        PlayerPrefsX.SetColor("colorwheels", wheelsColor);

        PlayerPrefs.Save();

        MyShowToastMethod("Your color has been saved!");
    }
    public void RandomColor()
    {
        randomColorActive = true;

        menuGUI.wheelColor.gameObject.SetActive(false);
        menuGUI.smokeColor.gameObject.SetActive(false);

        vehicleSetting[currentVehicleNumber].ringMat.SetColor("_Color", new Color(Random.Range(0.0f, 1.1f), Random.Range(0.0f, 1.1f), Random.Range(0.0f, 1.1f)));
        vehicleSetting[currentVehicleNumber].smokeMat.SetColor("_TintColor", new Color(Random.Range(0.0f, 1.1f), Random.Range(0.0f, 1.1f), Random.Range(0.0f, 1.1f), 0.2f));

        PlayerPrefsX.SetColor("VehicleWheelsColor" + currentVehicleNumber, vehicleSetting[currentVehicleNumber].ringMat.GetColor("_Color"));
        PlayerPrefsX.SetColor("VehicleSmokeColor" + currentVehicleNumber, vehicleSetting[currentVehicleNumber].smokeMat.GetColor("_TintColor"));
    }
    void HandleValueChanged(Color _color)
    {
        if (isPlayerPrefsLoaded == false)
        {
            return;
        }

        var ycgco = ProcAmp.RGB2YCgCo(_color);

        // Set Key color to the material
        keyingMaterial.SetVector("_KeyCgCo", new Vector2(ycgco.y, ycgco.z));
        // Save color with PlayerPrefsX
        PlayerPrefsX.SetColor("_KeyCgCo", _color);
        //Debug.Log("Picker OnValueChanged");
    }
Esempio n. 9
0
    public void SetColor(Toggle colorToggle)
    {
        if (!colorToggle.isOn)
        {
            return;
        }

        ColorInfo colorInfo = colorToggle.gameObject.GetComponent <ColorInfo>();

        PlayerPrefsX.SetColor("player1ActiveColor", colorInfo.player1ActiveColor);
        PlayerPrefsX.SetColor("player2ActiveColor", colorInfo.player2ActiveColor);
        PlayerPrefsX.SetColor("player1WinColor", colorInfo.player1WinColor);
        PlayerPrefsX.SetColor("player2WinColor", colorInfo.player2WinColor);
        PlayerPrefs.Save();
    }
    //Vehcile Color//////////////////////////////////////////////////////////////////////////////////////////////////////////////


    public void ActiveCurrentColor(Image activeImage)
    {
        mainColor = activeImage.color;

        if (menuGUI.wheelColor.gameObject.activeSelf)
        {
            vehicleSetting[currentVehicleNumber].ringMat.SetColor("_Color", mainColor);
            PlayerPrefsX.SetColor("VehicleWheelsColor" + currentVehicleNumber, mainColor);
        }
        else if (menuGUI.smokeColor.gameObject.activeSelf)
        {
            vehicleSetting[currentVehicleNumber].smokeMat.SetColor("_TintColor", new Color(mainColor.r, mainColor.g, mainColor.b, 0.2f));
            PlayerPrefsX.SetColor("VehicleSmokeColor" + currentVehicleNumber, new Color(mainColor.r, mainColor.g, mainColor.b, 0.2f));
        }
    }
Esempio n. 11
0
    /// <summary>
    /// Save all stats with PlayerPrefs.
    /// </summary>
    public static void SaveStats(RCC_CarControllerV3 car)
    {
        PlayerPrefs.SetFloat(car.transform.name + "_FrontCamber", car.FrontLeftWheelCollider.camber);
        PlayerPrefs.SetFloat(car.transform.name + "_RearCamber", car.RearLeftWheelCollider.camber);

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

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

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

        PlayerPrefs.SetFloat(car.transform.name + "_MaximumSpeed", car.maxspeed);
        PlayerPrefs.SetFloat(car.transform.name + "_MaximumBrake", car.brakeTorque);
        PlayerPrefs.SetFloat(car.transform.name + "_MaximumTorque", car.engineTorque);

        PlayerPrefs.SetString(car.transform.name + "_DrivetrainMode", car._wheelTypeChoise.ToString());

        PlayerPrefs.SetFloat(car.transform.name + "_GearShiftingThreshold", car.gearShiftingThreshold);
        PlayerPrefs.SetFloat(car.transform.name + "_ClutchingThreshold", car.clutchInertia);

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

        foreach (RCC_Light _light in car.GetComponentsInChildren <RCC_Light>())
        {
            if (_light.lightType == RCC_Light.LightType.HeadLight)
            {
                PlayerPrefsX.SetColor(car.transform.name + "_HeadlightsColor", _light.GetComponentInChildren <Light>().color);
                break;
            }
        }

        PlayerPrefsX.SetColor(car.transform.name + "_WheelsSmokeColor", car.RearLeftWheelCollider.allWheelParticles[0].startColor);

        PlayerPrefsX.SetBool(car.transform.name + "_ABS", car.ABS);
        PlayerPrefsX.SetBool(car.transform.name + "_ESP", car.ESP);
        PlayerPrefsX.SetBool(car.transform.name + "_TCS", car.TCS);
        PlayerPrefsX.SetBool(car.transform.name + "_SH", car.steeringHelper);

        PlayerPrefsX.SetBool(car.transform.name + "NOS", car.useNOS);
        PlayerPrefsX.SetBool(car.transform.name + "Turbo", car.useTurbo);
        PlayerPrefsX.SetBool(car.transform.name + "ExhaustFlame", car.useExhaustFlame);
        PlayerPrefsX.SetBool(car.transform.name + "SteeringSensitivity", car.steerAngleSensitivityAdjuster);
        PlayerPrefsX.SetBool(car.transform.name + "RevLimiter", car.useRevLimiter);
        PlayerPrefsX.SetBool(car.transform.name + "ClutchMargin", car.useClutchMarginAtFirstGear);
    }
Esempio n. 12
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());
     }
 }
Esempio n. 13
0
    private void Start()
    {
        // Human or AI settings
        player1AiToggle.isOn = PlayerPrefsX.GetBool("player1IsAI");
        player2AiToggle.isOn = PlayerPrefsX.GetBool("player2IsAI");

        player1AiToggle.onValueChanged.AddListener(delegate
        {
            SetPlayer1IsAI(player1AiToggle);
        });
        player2AiToggle.onValueChanged.AddListener(delegate
        {
            SetPlayer2IsAI(player2AiToggle);
        });

        // AI level settings
        if (!PlayerPrefs.HasKey("player1AILevel"))
        {
            PlayerPrefs.SetInt("player1AILevel", 2);
            PlayerPrefs.SetInt("player2AILevel", 2);
            PlayerPrefs.Save();
        }

        int player1Level = PlayerPrefs.GetInt("player1AILevel");
        int player2Level = PlayerPrefs.GetInt("player2AILevel");

        player1LevelNumber.GetComponent <TextMeshProUGUI>().text = player1Level.ToString();
        player1LevelSlider.value = player1Level;
        player2LevelNumber.GetComponent <TextMeshProUGUI>().text = player2Level.ToString();
        player2LevelSlider.value = player2Level;

        player1LevelSlider.onValueChanged.AddListener(delegate
        {
            SetPlayer1AILevel(player1LevelSlider);
        });
        player2LevelSlider.onValueChanged.AddListener(delegate
        {
            SetPlayer2AILevel(player2LevelSlider);
        });

        // Colors
        PlayerPrefsX.SetColor("player1ActiveColor", new Color(26 / 255f, 164 / 255f, 242 / 255f));
        PlayerPrefsX.SetColor("player2ActiveColor", new Color(225 / 255f, 45 / 255f, 37 / 255f));
        PlayerPrefsX.SetColor("player1WinColor", new Color(167 / 255f, 214 / 255f, 247 / 255f));
        PlayerPrefsX.SetColor("player2WinColor", new Color(255 / 255f, 90 / 255f, 94 / 255f));
        PlayerPrefs.Save();
    }
Esempio n. 14
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());
     }
 }
Esempio n. 15
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
    }
    // saves all necessary userdata into a savestate [playerprefs]
    public void SavePrefs()
    {
        PlayerPrefs.SetInt("firststart", 0);
        PlayerPrefs.SetString("user_gender", user.gender);
        PlayerPrefs.SetInt("user_age", user.age);
        PlayerPrefs.SetInt("user_height", user.height);
        PlayerPrefs.SetInt("user_weight", user.weight);
        PlayerPrefs.SetInt("user_lvl", user.lvl);
        PlayerPrefs.SetInt("user_totalXP", user.totalXP);
        //serialize workoutHistory-dict into json string and save it into the PlayerPrefs
        var sWorkoutHistory = JsonConvert.SerializeObject(workoutHistory);

        PlayerPrefs.SetString("workoutHistory", sWorkoutHistory);

        PlayerPrefsX.SetColor("mainColor", mainCol);
        PlayerPrefsX.SetColor("bgColor", bgCol);

        PlayerPrefs.SetInt("notification_h", NotificationTimer.h);
        PlayerPrefs.SetInt("notification_m", NotificationTimer.m);
    }
Esempio n. 17
0
 public static void SetMatColor(Color color)
 {
     PlayerPrefsX.SetColor(MAT_COLOR, color);
 }