void StringToStream(string txt) { Debug.Log("StringToStream " + txt); ynJsonError = false; stream = new List <StreamUnit>(); string[] lines = txt.Split('\n'); foreach (string line in lines) { if (line.Length > 0) { try { StreamUnit su = JsonUtility.FromJson <StreamUnit>(line); stream.Add(su); } catch (Exception e) { ynJsonError = true; Debug.Log("LoadFromString " + e.Message); // throw; } } } SetTextStream(txt); UpdateSliderStream(); Debug.Log("LoadFromString " + stream.Count + "\n"); }
void PlaySaveTrip() { StreamUnit su = stream[streamUnitCurrentIndex]; // inputFieldSaveTrip.text = su.actionInfo; inputFieldSaveTrip.onEndEdit.Invoke(su.actionInfo); }
void PlaySearch() { StreamUnit su = stream[streamUnitCurrentIndex]; // inputFieldSearch.text = su.actionInfo; inputFieldSearch.onEndEdit.Invoke(su.actionInfo); }
void PlayLoadedTrip() { StreamUnit su = stream[streamUnitCurrentIndex]; string txtLatLons = su.actionInfo; Debug.Log("PlayTripLoaded |" + txtLatLons + "|"); buttonLoadedTrip = FindLoadedTripButton(txtLatLons); PlayButton(buttonLoadedTrip); }
void PlaySearchResult() { StreamUnit su = stream[streamUnitCurrentIndex]; string txtLatLon = su.actionInfo; Debug.Log("PlaySearchResult |" + txtLatLon + "|"); buttonSearchResult = FindSearchResultButton(txtLatLon); if (buttonSearchResult == null) { Debug.Log("null buttonSearchResult"); } PlayButton(buttonSearchResult); }
StreamUnit CreateStreamUnit(StreamActionType actionType, string actionInfo) { StreamUnit su = new StreamUnit { key = key, dateTimeStart = strDateTimeStart, timeDelta = timeDelta, actionType = actionType.ToString(), actionInfo = actionInfo }; return(su); }
void Test() { strDateTimeStart = DateToString(DateTime.Now); StreamUnit su = CreateStreamUnit(StreamActionType.tripType, StreamTripType.Load.ToString()); su.actionType = StreamActionType.compass.ToString(); string json = JsonUtility.ToJson(su); Debug.Log("|" + json + "|"); StreamUnit su2 = JsonUtility.FromJson <StreamUnit>(json); Debug.Log("su2.actionType " + su2.actionType); }
void PlayTransportationType() { StreamUnit su = stream[streamUnitCurrentIndex]; StreamTransportationType transportationType = StringToTransportationType(su.actionInfo); switch (transportationType) { case StreamTransportationType.walking: PlayButton(buttonWalking); break; case StreamTransportationType.bus: PlayButton(buttonBus); break; } }
void PlayTripType() { StreamUnit su = stream[streamUnitCurrentIndex]; StreamTripType tripType = StringToTripType(su.actionInfo); switch (tripType) { case StreamTripType.New: PlayButton(buttonNewTrip); break; case StreamTripType.Load: PlayButton(buttonLoadTrip); break; } }
void PlayUserType() { StreamUnit su = stream[streamUnitCurrentIndex]; StreamUserType userType = StringToUserType(su.actionInfo); switch (userType) { case StreamUserType.MCI: PlayButton(buttonMCI); break; case StreamUserType.Visual: PlayButton(buttonVisual); break; } }
void PlayStreamUnitCurrent() { StreamUnit su = stream[streamUnitCurrentIndex]; switch (StringToActionType(su.actionType)) { case StreamActionType.userType: PlayUserType(); break; case StreamActionType.tripType: PlayTripType(); break; case StreamActionType.compass: PlayCompass(); break; case StreamActionType.loadedTrip: PlayLoadedTrip(); break; case StreamActionType.searchResult: PlaySearchResult(); break; case StreamActionType.search: PlaySearch(); break; case StreamActionType.transportationType: PlayTransportationType(); break; case StreamActionType.saveTrip: PlaySaveTrip(); break; case StreamActionType.confirm: PlayConfirm(); break; } }
public void RecordAction(StreamActionType actionType, string actionInfo) { if (sessionState != StreamState.record && actionType != StreamActionType.apiRequest && actionType != StreamActionType.apiResponse && actionType != StreamActionType.gps) { return; } // timeDelta = Time.realtimeSinceStartup - timeDeltaStart; StreamUnit su = CreateStreamUnit(actionType, actionInfo); stream.Add(su); // string txt = JsonUtility.ToJson(su); SetTextStream(txt); if (ynCloud) { StringToCloud(txt); } }