Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using AC;
  5.  
  6. public class Slots: MonoBehaviour {
  7.  
  8.  
  9. public string slot1;
  10. public string slot2;
  11. public string slot3;
  12.  
  13.  
  14. void Start()
  15. {
  16.  
  17.  
  18. slot1 = LoadProfileVariable(0, 82);
  19. slot2 = LoadProfileVariable(1, 83);
  20. slot3 = LoadProfileVariable(2, 84);
  21.  
  22. Debug.Log(slot1);
  23. Debug.Log(slot2);
  24. Debug.Log(slot3);
  25. }
  26.  
  27. void Update ()
  28. {
  29.  
  30.  
  31. GlobalVariables.SetStringValue(82, slot1, true);
  32. GlobalVariables.SetStringValue(83, slot2, true);
  33. GlobalVariables.SetStringValue(84, slot3, true);
  34.  
  35.  
  36.  
  37. }
  38.  
  39. public string LoadProfileVariable(int profileID, int varID)
  40. {
  41. OptionsData profileData = Options.LoadPrefsFromID(profileID);
  42. string variableData = profileData.linkedVariables;
  43.  
  44. string[] varsArray = variableData.Split(SaveSystem.pipe[0]);
  45. foreach (string chunk in varsArray)
  46. {
  47. string[] chunkData = chunk.Split(SaveSystem.colon[0]);
  48.  
  49. int _id = 0;
  50. int.TryParse(chunkData[0], out _id);
  51.  
  52. if (_id == varID)
  53. {
  54. return chunkData[1];
  55. }
  56. }
  57.  
  58. return string.Empty;
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement