Exemple #1
0
    public void Initialize(byte[] initData, byte[] waspData)
    {
        LoadJson(Application.dataPath + "/Resources/config.json");

        JsonInitContainer container = null;

        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonInitContainer));

        using (MemoryStream stream = new MemoryStream(initData))
        {
            container = serializer.ReadObject(stream) as JsonInitContainer;
        }

        if (!IndependantMP)
        {
            SnapThresh            = container.snapThreshold;
            AngleTighteningFactor = container.angleTightFactor;
            NumParts = container.numberOfParts;
            //FieldRes = container.fieldResolution;
            IndependantMP = container.independantMP;
        }

        InitializeGame();

        GlobalReferences.PartSpawner = new PartsHolder(NumParts, null, waspData);
    }
Exemple #2
0
    private void LoadJson(string path)
    {
        JsonInitContainer container = null;

        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonInitContainer));

        using (FileStream stream = new FileStream(path, FileMode.Open))
        {
            container = serializer.ReadObject(stream) as JsonInitContainer;
        }

        if (container != null)
        {
            SaveLoc = container.saveLoc;
            LoadLoc = container.loadLoc;

            VrFps = container.vrFps;

            SnapThresh            = container.snapThreshold;
            AngleTighteningFactor = container.angleTightFactor;

            NumParts = container.numberOfParts;

            colorScheme = container.colScheme;
        }
    }
Exemple #3
0
    private void LoadJson(string path)
    {
        JsonInitContainer container = null;

        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonInitContainer));

        using (FileStream stream = new FileStream(path, FileMode.Open))
        {
            container = serializer.ReadObject(stream) as JsonInitContainer;
        }

        if (container != null)
        {
            SaveLoc = container.saveLoc;
            LoadLoc = container.loadLoc;

            VrFps = container.vrFps;

            SnapThresh = container.snapThreshold;
            NumParts   = container.numberOfParts;

            minX = container.minX;
            maxX = container.maxX;

            minY = container.minY;
            maxY = container.maxY;

            minZ = container.minZ;
            maxZ = container.maxZ;

            ConRes = container.conRes;
            ColRes = container.colRes;
        }
    }
Exemple #4
0
    bool LoadConfigFile(string path)
    {
        JsonInitContainer container = null;

        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonInitContainer));

        try
        {
            using (FileStream stream = new FileStream(path, FileMode.Open))
            {
                container = serializer.ReadObject(stream) as JsonInitContainer;
            }
        }
        catch
        {
            Debug.LogError("Could not find config file");
        }

        if (container != null)
        {
            saveLocation           = container.saveLoc;
            inputLocation          = container.loadLoc;
            playerSettingsLocation = container.playerSettingsLoc;

            SnapThreshold  = container.snapThreshold;
            AngleTolerance = container.angleTightFactor;

            NumParts = container.numberOfParts;

            colorScheme = container.colScheme;

            anaglyphMode = (AnaglyphizerC.Mode)container.anaglyph;

            multiplayerName = container.multiplayerName;

            independantMP = container.independantMP;

            fog = container.fog;

            shootDist = container.shootDistVisibility;
        }

        return(container != null);
    }
Exemple #5
0
    private void LoadJson(string path)
    {
        JsonInitContainer container = null;

        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonInitContainer));

        using (FileStream stream = new FileStream(path, FileMode.Open))
        {
            container = serializer.ReadObject(stream) as JsonInitContainer;
        }

        if (container != null)
        {
            SaveLoc           = container.saveLoc;
            LoadLoc           = container.loadLoc;
            PlayerSettingsLoc = container.playerSettingsLoc;

            VrFps = container.vrFps;

            SnapThresh            = container.snapThreshold;
            AngleTighteningFactor = container.angleTightFactor;

            NumParts = container.numberOfParts;

            //FieldRes = container.fieldResolution;

            colorScheme = container.colScheme;

            anaglyph = (AnaglyphizerC.Mode)container.anaglyph;

            MultiplayerName = container.multiplayerName;

            IndependantMP = container.independantMP;

            ControllerReferences.IndependantMP = IndependantMP;

            fog = container.fog;

            shootDistVisibility = container.shootDistVisibility;
        }
    }
Exemple #6
0
    public void SaveConfigFile(string path)
    {
        JsonInitContainer container = new JsonInitContainer();

        container.loadLoc = inputLocation;
        Debug.Log("Input Loc: " + inputLocation);
        container.saveLoc = saveLocation;
        Debug.Log("Save Loc: " + saveLocation);
        container.playerSettingsLoc = playerSettingsLocation;
        Debug.Log("Player Settings Loc: " + playerSettingsLocation);
        container.numberOfParts = numParts;
        Debug.Log("NumParts: " + numParts);
        container.snapThreshold = snapThreshold;
        Debug.Log("Snap Threshold: " + snapThreshold);
        container.colScheme = colorScheme;
        Debug.Log("ColorScheme: " + colorScheme);
        container.angleTightFactor = angleTolerance;
        Debug.Log("Angle Tolerance: " + angleTolerance);
        container.anaglyph = (int)anaglyphMode;
        Debug.Log("Anaglyph: " + (int)anaglyphMode);
        container.multiplayerName = multiplayerName;
        Debug.Log("Multiplayer Name: " + multiplayerName);
        container.independantMP = independantMP;
        Debug.Log("IndependantMP: " + independantMP);
        container.fog = fog;
        Debug.Log("Fog: " + fog);
        container.shootDistVisibility = shootDist;
        Debug.Log("Shoot Visibilizty: " + shootDist);

        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(JsonInitContainer));

        Debug.Log("Container: " + container.ToString());

        using (FileStream stream = new FileStream(path, FileMode.Create))
        {
            serializer.WriteObject(stream, container);
        }
    }