mirror of
https://github.com/ConjureETS/MTI860_VR_Multi_Controller.git
synced 2026-03-24 04:21:15 +00:00
Update DataSaver et Position
This commit is contained in:
parent
834444bc41
commit
a0c11be8f6
@ -6171,6 +6171,11 @@ PrefabInstance:
|
||||
propertyPath: NextScene
|
||||
value: StraghtCorridor
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465,
|
||||
type: 3}
|
||||
propertyPath: IsQuickTeleport
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465,
|
||||
type: 3}
|
||||
propertyPath: noMovementChange
|
||||
@ -10346,6 +10351,11 @@ PrefabInstance:
|
||||
propertyPath: NextScene
|
||||
value: StraghtCorridor
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465,
|
||||
type: 3}
|
||||
propertyPath: IsQuickTeleport
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465,
|
||||
type: 3}
|
||||
propertyPath: noMovementChange
|
||||
@ -10756,6 +10766,11 @@ PrefabInstance:
|
||||
propertyPath: NextScene
|
||||
value: StraghtCorridor
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465,
|
||||
type: 3}
|
||||
propertyPath: IsQuickTeleport
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3445185087018901932, guid: 1d0368ccaf6b0f6418f73a0180971465,
|
||||
type: 3}
|
||||
propertyPath: noMovementChange
|
||||
|
||||
@ -8,9 +8,12 @@ namespace Assets.Scripts
|
||||
{
|
||||
class Constant
|
||||
{
|
||||
public const string SEPARATOR = "-";
|
||||
|
||||
// Files
|
||||
public const string FILE_PATH = ""; // DO NOT PUSH THIS, OR I KILL YOU... TWICE
|
||||
public const string FILE_TIME = "TimeFile.txt";
|
||||
public const string FILE_TIME = "TimeFile";
|
||||
public const string FILE_EXTENSION = ".txt";
|
||||
|
||||
// Game Tag
|
||||
public const string GT_TARGET = "Target";
|
||||
|
||||
@ -16,27 +16,33 @@ namespace Assets.Scripts.Utilities
|
||||
string movementName = ((MovementGen.ChoiceOfMovement)PlayerPrefs.GetInt(Constant.PPK_MOVEMENT_CHOICE)).ToString();
|
||||
string time = PlayerPrefs.GetString(Constant.PPK_TIMER_TIME);
|
||||
string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME);
|
||||
string toSave = movementName + " - " + playerName + " - " + stage + " - "+ time;
|
||||
string toSave = movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage + Constant.SEPARATOR + time;
|
||||
writeToFile(toSave);
|
||||
}
|
||||
|
||||
public static void SavePosition(List<Position> position)
|
||||
public static void SavePosition(List<Position> positions)
|
||||
{
|
||||
//TODO
|
||||
string playerName = PlayerPrefs.GetString(Constant.PPK_PLAYER_NAME);
|
||||
string movementName = ((MovementGen.ChoiceOfMovement)PlayerPrefs.GetInt(Constant.PPK_MOVEMENT_CHOICE)).ToString();
|
||||
string stage = PlayerPrefs.GetString(Constant.PPK_SCENE_NAME);
|
||||
string fileName = movementName + Constant.SEPARATOR + playerName + Constant.SEPARATOR + stage;
|
||||
writeToFile(positions, fileName);
|
||||
}
|
||||
|
||||
private static async void writeToFile(string toSave)
|
||||
{
|
||||
using StreamWriter file = new(Constant.FILE_PATH + Constant.FILE_TIME);
|
||||
|
||||
using StreamWriter file = File.AppendText(Constant.FILE_PATH + Constant.FILE_TIME + Constant.FILE_EXTENSION);
|
||||
await file.WriteLineAsync(toSave);
|
||||
}
|
||||
|
||||
private static async void writeToFile(List<float, float> toSave, string fileName)
|
||||
private static async void writeToFile(List<Position> positions, string fileName)
|
||||
{
|
||||
using StreamWriter file = new(Constant.FILE_PATH + fileName);
|
||||
using StreamWriter file = File.AppendText(Constant.FILE_PATH + fileName + Constant.FILE_EXTENSION);
|
||||
|
||||
await file.WriteLineAsync(toSave);
|
||||
foreach (Position pos in positions)
|
||||
{
|
||||
await file.WriteLineAsync(pos.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts.Utilities
|
||||
namespace Assets.Scripts.Utilities
|
||||
{
|
||||
class Position
|
||||
{
|
||||
private float x { get; set; };
|
||||
private float y { get; set; };
|
||||
public Position(x, y)
|
||||
private float x { get; set; }
|
||||
private float y { get; set; }
|
||||
|
||||
public Position(float x, float y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "[" + x.ToString() + "|" + y.ToString() + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user