Example #1
0
    void Awake()
    {
        AccountID   = GameObject.Find("AccountID_DontDestroy").GetComponent <AccountID>().theID;
        passedID    = GameObject.Find("charID_DontDestroy").GetComponent <fromCharToCode>().name;
        ForOrder    = new GameObject[5];
        ForOrder[0] = ForBoss;
        ForOrder[1] = ForMiniBoss;
        ForOrder[2] = ForMelee;
        ForOrder[3] = ForRange;
        ForOrder[4] = ForTank;

        TextAsset JData;

        //만약 codeeditor_IDpasser에서 온 경우일 경우 이걸 해야된당...
        tempID theTempID = GameObject.Find("charID_DontDestroy").GetComponent <tempID>();

        if (theTempID != null)
        {//만약 이게 있으면?
            JData = Resources.Load(theTempID.theID + passedID + "/TargetOrder") as TextAsset;
        }
        else
        {                                                                                                                      //만약 이게 없으면?
            JData = Resources.Load("Json_AccountInfo/" + AccountID.ToString() + "/" + passedID + "/TargetOrder") as TextAsset; //끝
        }
        string jdata = JData.text;


        theTargetOrderInformation = JsonConvert.DeserializeObject <TargetOrderInformation>(jdata);
        loadOnScene();
    }
Example #2
0
    void Awake()
    {
        AccountID = GameObject.Find("AccountID_DontDestroy").GetComponent <AccountID>().theID;
        passedID  = GameObject.Find("charID_DontDestroy").GetComponent <fromCharToCode>().name;
        TextAsset JData;

        //만약 codeeditor_IDpasser에서 온 경우일 경우 이걸 해야된당...
        tempID theTempID = GameObject.Find("charID_DontDestroy").GetComponent <tempID>();

        if (theTempID != null)
        {//만약 이게 있으면?
            JData = Resources.Load(theTempID.theID + passedID + "/ActionData") as TextAsset;
        }
        else
        {                                                                                                                     //만약 이게 없으면?
            JData = Resources.Load("Json_AccountInfo/" + AccountID.ToString() + "/" + passedID + "/ActionData") as TextAsset; //끝
        }
        string jdata = JData.text;

        //string jdata = File.ReadAllText(Application.dataPath + "/Resources/CodeEditor/ActionData.json");
        //byte[] bytes = System.Convert.FromBase64String(jdata);
        //string reformat = System.Text.Encoding.UTF8.GetString(bytes); // this is the actual string
        //actionList = JsonConvert.DeserializeObject<List<Action_CodeModifier>>(reformat);
        actionList = JsonConvert.DeserializeObject <List <Action_CodeModifier> >(jdata);
        loadOnScene();
    }
Example #3
0
    public void saveTargetOrder()
    {
        theTargetOrderInformation.closeFar = closeFar;
        int[] tempArray;
        int   temp1, temp2, temp3, temp4, temp5; //순서 숫자

        temp1     = int.Parse(ForOrder[0].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text);
        temp2     = int.Parse(ForOrder[1].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text);
        temp3     = int.Parse(ForOrder[2].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text);
        temp4     = int.Parse(ForOrder[3].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text);
        temp5     = int.Parse(ForOrder[4].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text);
        tempArray = new int[] { temp1, temp2, temp3, temp4, temp5 };
        theTargetOrderInformation.aimOrderArray = tempArray;

        string jdata = JsonConvert.SerializeObject(theTargetOrderInformation);

        jdata = JValue.Parse(jdata).ToString(Formatting.Indented);
        //byte[] bytes = System.Text.Encoding.UTF8.GetBytes(jdata);
        //string format = System.Convert.ToBase64String(bytes);
        //File.WriteAllText(Application.dataPath + "/Scripts/CodeEditor/ConditionData.json",format);

        tempID theTempID = GameObject.Find("charID_DontDestroy").GetComponent <tempID>();

        if (theTempID != null)
        {//만약 이게 있으면? temp에서 넘어온 아이다.
            File.WriteAllText(Application.dataPath + "/Resources/" + theTempID.theID + passedID + "/TargetOrder.json", jdata);
        }
        else
        {                                                                                                                                                  //만약 이게 없으면?
            File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + AccountID.ToString() + "/" + passedID + "/TargetOrder.json", jdata); //ID 추가해주기
        }
        Debug.Log("TargetOrder is saved");
        AssetDatabase.Refresh();
    }
Example #4
0
    public void WriteJson()
    {
        string tempID = this.transform.GetComponent <Actions>().passedID;
        string jdata  = JsonConvert.SerializeObject(finalizeString);

        jdata = JValue.Parse(jdata).ToString(Formatting.Indented);

        tempID theTempID = GameObject.Find("charID_DontDestroy").GetComponent <tempID>();

        if (theTempID != null)
        {//만약 이게 있으면? temp에서 넘어온 아이다.
            File.WriteAllText(Application.dataPath + "/Resources/" + theTempID.theID + tempID + "/AlgorithmForGame.json", jdata);
        }
        else
        {//만약 이게 없으면?
            File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + AccountID.ToString() + "/" + tempID + "/AlgorithmForGame.json", jdata);
        }
        print("Converted Json Created!!");
    }
Example #5
0
    public void _save()
    {
        string jdata = JsonConvert.SerializeObject(actionList);

        jdata = JValue.Parse(jdata).ToString(Formatting.Indented);
        //byte[] bytes = System.Text.Encoding.UTF8.GetBytes(jdata);
        //string format = System.Convert.ToBase64String(bytes);
        //File.WriteAllText(Application.dataPath + "/Scripts/CodeEditor/ActionData.json",format);

        tempID theTempID = GameObject.Find("charID_DontDestroy").GetComponent <tempID>();

        if (theTempID != null)
        {//만약 이게 있으면? temp에서 넘어온 아이다.
            File.WriteAllText(Application.dataPath + "/Resources/" + theTempID.theID + passedID + "/ActionData.json", jdata);
        }
        else
        {//만약 이게 없으면?
            File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + AccountID.ToString() + "/" + passedID + "/ActionData.json", jdata);
        }
        Debug.Log("Action is saved");
        AssetDatabase.Refresh();
    }