// Start is called before the first frame update void Start() { myData = new MetaJson(); myLoreHandler.myData = myData; myLoreHandler.InitializeLore(); myCombatHandler.allMobs = myData.allMobs; myLootHandler.allItems = myData.allItems; myLootHandler.GeneratePoolItems(); myLootHandler.GeneratePoolItemsShop(); SetFollower(); NewGame(); }
public (List <User>, bool) GetUsers() { bool returnValue = true; RestRequest request = new RestRequest("/{version}/admin/users", Method.GET); request.Parameters.Clear(); request.AddParameter("version", _ver, ParameterType.UrlSegment); request.AddParameter("page[page]", currPage, ParameterType.QueryString); request.AddParameter("page[per_page]", returnPerPage, ParameterType.QueryString); request.AddHeader("Content-Type", "application/json"); request.AddParameter("Authorization", _token.token_type + " " + _token.access_token, ParameterType.HttpHeader); IRestResponse response = _client.Execute(request); HttpStatusCode statusCode = response.StatusCode; int numericCode = (int)statusCode; if (numericCode != 200) { throw new FoundryException(response.ErrorMessage, numericCode, response.Content); } UserDataJsonList userData = JsonConvert.DeserializeObject <UserDataJsonList>(response.Content); List <User> users = new List <User>(); foreach (UserData data in userData.Data) { User newUser = data.UserAttributes; newUser.ConfigureUserData(data); if (newUser.Location != null) { newUser.Location = GetLocationById(newUser.LocationId); } users.Add(newUser); } MetaJson metaData = JsonConvert.DeserializeObject <MetaJson>(response.Content); Console.WriteLine("Returning " + users.Count + " users. Page " + currPage + " of " + Math.Ceiling((double)metaData.Meta.Count / returnPerPage)); if (currPage * returnPerPage >= metaData.Meta.Count) { returnValue = false; currPage = 1; } else { currPage += 1; } return(users, returnValue); }
void Awake() { car = carObj.GetComponent <ICar>(); if (bDoLog && car != null) { if (UdacityStyle) { outputFilename = "driving_log.csv"; } string filename = GetLogPath() + outputFilename; writer = new StreamWriter(filename); Debug.Log("Opening file for log at: " + filename); if (UdacityStyle) { writer.WriteLine("center,left,right,steering,throttle,brake,speed"); } if (DonkeyStyle2) { MetaJson mjson = new MetaJson(); string[] inputs = { "cam/image_array", "user/angle", "user/throttle", "user/mode", "track/lap", "track/loc" }; string[] types = { "image_array", "float", "float", "str", "int", "int" }; mjson.Init(inputs, types); string json = JsonUtility.ToJson(mjson); var f = File.CreateText(GetLogPath() + "meta.json"); f.Write(json); f.Close(); } } Canvas canvas = GameObject.FindObjectOfType <Canvas>(); GameObject go = CarSpawner.getChildGameObject(canvas.gameObject, "LogCount"); if (go != null) { logDisplay = go.GetComponent <Text>(); } imagesToSave = new List <ImageSaveJob>(); thread = new Thread(SaverThread); thread.Start(); }
void Awake() { car = carObj.GetComponent <ICar>(); if (bDoLog && car != null) { if (UdacityStyle) { outputFilename = "/../log/driving_log.csv"; } string filename = Application.dataPath + outputFilename; writer = new StreamWriter(filename); Debug.Log("Opening file for log at: " + filename); if (UdacityStyle) { writer.WriteLine("center,left,right,steering,throttle,brake,speed"); } if (DonkeyStyle2) { MetaJson mjson = new MetaJson(); string[] inputs = { "cam/image_array", "user/angle", "user/throttle", "user/mode" }; string[] types = { "image_array", "float", "float", "str" }; mjson.Init(inputs, types); string json = JsonUtility.ToJson(mjson); var f = File.CreateText(Application.dataPath + "/../log/meta.json"); f.Write(json); f.Close(); } } imagesToSave = new List <ImageSaveJob>(); thread = new Thread(SaverThread); thread.Start(); }
public int GetUserCount() { RestRequest request = new RestRequest("/{version}/admin/users/?page[page]={page_num}&page[per_page]={num_per}", Method.GET); request.Parameters.Clear(); request.AddParameter("version", _ver, ParameterType.UrlSegment); request.AddParameter("page_num", 1, ParameterType.UrlSegment); request.AddParameter("num_per", returnPerPage, ParameterType.UrlSegment); request.AddHeader("Content-Type", "application/json"); request.AddParameter("Authorization", _token.token_type + " " + _token.access_token, ParameterType.HttpHeader); IRestResponse response = _client.Execute(request); HttpStatusCode statusCode = response.StatusCode; int numericCode = (int)statusCode; if (numericCode != 200) { throw new FoundryException(response.ErrorMessage, numericCode, response.Content); } MetaJson metaData = JsonConvert.DeserializeObject <MetaJson>(response.Content); return(metaData.Meta.Count); }