コード例 #1
0
 public void Initialize(RunePathInfo runePathInfo)
 {
     this.runePathInfo = runePathInfo;
     strPathName       = runePathInfo.pathName;
     runeStones        = new List <GameObject>();
     GenerateRunePath(runePathInfo);
 }
コード例 #2
0
 private void GenerateRunePath(RunePathInfo runePathInfo)
 {
     if (runePathInfo.isPrimary)
     {
         Debug.Log("Generating Primary Path");
         GameObject runeStone = GameObjectUtility.CustomInstantiate(individualRuneGameObject, columnGameObject.transform);
         runeStones.Add(runeStone);
         runeStone.GetComponent <IndividualRune>().Initialize(runePathInfo.keystone, strPathName);
         foreach (RuneStone rs in runePathInfo.runeStones)
         {
             GameObject rsGo = GameObjectUtility.CustomInstantiate(individualRuneGameObject, columnGameObject.transform);
             runeStones.Add(rsGo);
             rsGo.GetComponent <IndividualRune>().Initialize(rs, strPathName);
         }
     }
     else
     {
         Debug.Log("Generating Secondary Path");
         foreach (RuneStone rs in runePathInfo.runeStones)
         {
             GameObject rsGo = GameObjectUtility.CustomInstantiate(individualRuneGameObject, columnGameObject.transform);
             runeStones.Add(rsGo);
             rsGo.GetComponent <IndividualRune>().Initialize(rs, strPathName);
         }
     }
 }
コード例 #3
0
 public static RunePathData RunePathInfo_to_RunePathData(RunePathInfo rpInfo, bool isPri)
 {
     return(new RunePathData
     {
         pathName = rpInfo.pathName,
         keyStone = rpInfo.keystone,
         runeStones = rpInfo.runeStones
     });
 }
コード例 #4
0
    private void DisplayRunePath(RunePathData primaryRunePathData, RunePathData secondaryRunePathData, bool isEmpty = true)
    {
        if (isEmpty)
        {
            RunePathInfo rpInfo = RunePathInfo.RunePathData_to_RunePathInfo(primaryRunePathData, true); //for debug usee
            Debug.Log("Displaying RunePath: \n" + rpInfo.ToString());                                   //for debug use

            primaryRunePath.Initialize(RunePathInfo.RunePathData_to_RunePathInfo(primaryRunePathData, true));
            secondaryRunePath.Initialize(RunePathInfo.RunePathData_to_RunePathInfo(secondaryRunePathData, false));
        }
    }
コード例 #5
0
    public void Save()
    {
        RuneInfo rInfo = GetRuneInfo();

        userInfo.SetRuneInfo(rInfo);

        RunePathInfo rp_1 = primaryRunePath.GetPathInfo(true);
        RunePathInfo rp_2 = secondaryRunePath.GetPathInfo(false);

        string jsonStr_1 = JsonUtility.ToJson(RunePathInfo.RunePathInfo_to_RunePathData(rp_1, true), true);

        System.IO.File.WriteAllText(Application.streamingAssetsPath + "/SavedRunePages/" + userName + "/" + "PrimaryPath" + runePageSeletor.value + ".json", jsonStr_1);
        string jsonStr_2 = JsonUtility.ToJson(RunePathInfo.RunePathInfo_to_RunePathData(rp_2, true), true);

        System.IO.File.WriteAllText(Application.streamingAssetsPath + "/SavedRunePages/" + userName + "/" + "SecondaryPath" + runePageSeletor.value + ".json", jsonStr_2);

        Debug.Log("Saved RunePage exists: " + System.IO.File.Exists("Assets/StreamingAssets/" + "SavedRunePages/Annie/PrimaryPath0.json"));
        Debug.Log("RunePage Saved");
    }
コード例 #6
0
 public void ChangePath(string selectedPath, bool isPrimary)
 {
     if (isPrimary)
     {
         secPS.GetComponent <RunePathSelector>().RegenearteSecondaryPathSelections(selectedPath);
         primaryRunePath.Clear();
         secondaryRunePath.Clear();
         RunePathData primaryPathData   = LoadRunePathData(selectedPath, true);
         RunePathData secondaryPathData = primaryPathData;
         primaryRunePath.Initialize(RunePathInfo.RunePathData_to_RunePathInfo(primaryPathData, true));
         secondaryRunePath.Initialize(RunePathInfo.RunePathData_to_RunePathInfo(secondaryPathData, false));
         secondaryRunePath.Clear();
     }
     else
     {
         secondaryRunePath.Clear();
         RunePathData secondaryPathData = LoadRunePathData(selectedPath, false);
         secondaryRunePath.Initialize(RunePathInfo.RunePathData_to_RunePathInfo(secondaryPathData, false));
     }
 }
コード例 #7
0
    private RunePathData LoadRunePathData(bool isPrimary)//for saved data
    {
        string path = "Assets/StreamingAssets/SavedRunePages/"
                      + userName + "/" + (isPrimary ? "Primary" : "Secondary") + "Path" + runePageSeletor.value + ".json";

        if (File.Exists(path))
        {
            string dataAsJson;
            dataAsJson = File.ReadAllText(path);
            RunePathData runePathData = new RunePathData();
            runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson);
            Debug.Log("Found Saved RunePage at " + path);
            Debug.Log(RunePathInfo.RunePathData_to_RunePathInfo(runePathData, isPrimary).ToString());
            return(runePathData);
        }
        else
        {
            Debug.Log("Did not Find Save RunePage at " + path);
            return(LoadRunePathData((isPrimary ? "Domination" : "Inspiration"), isPrimary));
        }
    }