示例#1
0
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(gameObject);
     SceneManager.LoadScene("MainScene");
     locationData = loadGameData();
     score        = new int[playerCount];
     maxScore     = locationData.places.Length;
 }
示例#2
0
 // Use this for initialization
 void Start()
 {
     jsonLocationSource = FindObjectOfType <DataLoader> ();
     data = jsonLocationSource.locationData;
     for (int i = 0; i < data.places.Length; i++)
     {
         GameObject       mapPoint = Instantiate(mapPointer);
         highlightPointer mapPHL   = mapPoint.GetComponent <highlightPointer> ();
         mapPHL.pointLoc = data.places[i];
         mapPHL.index    = i;
     }
 }
示例#3
0
    private JsonDataInput loadGameData()
    {
        string filePath = Path.Combine(Application.streamingAssetsPath, gameDataFileName);

        if (File.Exists(filePath))
        {
            string        dataAsJson   = File.ReadAllText(filePath);
            JsonDataInput locationData = JsonUtility.FromJson <JsonDataInput> (dataAsJson);
            return(locationData);
        }
        return(null);
    }
        public static BrokerMessage deserialize(Data data)
        {
            JsonDataInput jsonInput = new JsonDataInput(data);

            JsonInputHelper.scanToNextToken(jsonInput);
            

            JsonArray messageComponents;
            try
            {
                messageComponents = _jsonArrayHandler.readJSONArray(jsonInput);
            }
            catch (BaseException exception)
            {
                exception.addContext("Serializer.dataOffset", jsonInput.Cursor);
                throw exception;
            }
            

            BrokerMessage answer = new BrokerMessage(messageComponents);

            return answer;

        }