public VersionTranslator(HanaVersion hanaVersion, string host, string instance) { _hanaVersion = hanaVersion; switch (hanaVersion) { case HanaVersion.v1_00_60: _urlEpmBase = @"http://" + host + ":80" + instance + _epmPackagePath_60; break; case HanaVersion.v1_00_70: _urlEpmBase = @"http://" + host + ":80" + instance + _epmPackagePath_70; break; case HanaVersion.v1_00_72: _urlEpmBase = @"http://" + host + ":80" + instance + _epmPackagePath_72; break; case HanaVersion.v1_00_80: _urlEpmBase = @"http://" + host + ":80" + instance + _epmPackagePath_80; break; default: break; } }
public WwwResponse GetConnResponse_VerDet(HanaVersion hanaVersion) { WwwResponse wwwResponse = new WwwResponse(); switch (hanaVersion) { case HanaVersion.v1_00_60: wwwResponse = _connDataVerDet60Response; break; case HanaVersion.v1_00_70: wwwResponse = _connDataVerDet70Response; break; case HanaVersion.v1_00_72: wwwResponse = _connDataVerDet72Response; break; default: break; } return wwwResponse; }
/// <summary> /// Starts new game state. sceneName is an actual scene to start with, not a login screen /// </summary> public void StartNewGameState(HanaVersion hanaVersion, string host, string instance, string username, string password, bool isOffline, string sceneName) { if (_isCreated) return; Debug.Log("Starting game... version: " + hanaVersion.ToString() + " host: " + host + " instance " + instance + " user: "******" offline: " + isOffline /*+ " " + _passwordToEdit*/, this); _verTranslator = new VersionTranslator(hanaVersion, host, instance); _isCreated = true; _username = username; _password = password; _isOffline = isOffline; // Load scene (an actual scene, not a login screen) if (!string.IsNullOrEmpty(sceneName)) { Cursor.visible = false; Application.LoadLevel(sceneName); } }
public void GetConnData_VerDet(HanaVersion hanaVersion, string host, string instance) { string url = VersionTranslator.GetUrl_ToCheckForAVersion(hanaVersion, host, instance); switch (hanaVersion) { case HanaVersion.v1_00_60: GetWwwData(url, WwwDataType.ConnVerDet_60); break; case HanaVersion.v1_00_70: GetWwwData(url, WwwDataType.ConnVerDet_70); break; case HanaVersion.v1_00_72: GetWwwData(url, WwwDataType.ConnVerDet_72); break; default: break; } }
/// <summary> /// Gets the url to check for a hana version. /// Static so it can called before actual version is known /// </summary> public static string GetUrl_ToCheckForAVersion(HanaVersion hanaVersion, string host, string instance) { string url = ""; switch (hanaVersion) { case HanaVersion.v1_00_60: // 60 // URL PO chart data (internal) // http://uvo1lhvt5s58vittd8f.vm.cld.sr:8000/sap/hana/democontent/epm/services/poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PartnerCity¤cy=USD&filterterms= url = @"http://" + host + ":80" + instance + _epmPackagePath_60 + @"poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PartnerCity¤cy=USD&filterterms="; break; case HanaVersion.v1_00_70: // 70 // URL PO chart data (internal) // http://54.86.47.170:8002/sap/hana/democontent/epm/services/poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PARTNERCITY¤cy=USD&filterterms= url = @"http://" + host + ":80" + instance + _epmPackagePath_70 + @"poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PARTNERCITY¤cy=USD&filterterms="; break; case HanaVersion.v1_00_72: // 72 // URL PO chart data (internal) // http://54.178.200.169:8000/sap/hana/democontent/epmNext/services/poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PartnerCity¤cy=USD&filterterms= [note fields TitleCase] url = @"http://" + host + ":80" + instance + _epmPackagePath_72 + @"poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PartnerCity¤cy=USD&filterterms="; break; case HanaVersion.v1_00_80: // 80 // URL PO chart data (internal) // http://54.178.200.169:8000/sap/hana/democontent/epm/services/poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PARTNERCITY¤cy=USD&filterterms= [note fields back to UPPERCASE] url = @"http://" + host + ":80" + instance + _epmPackagePath_80 + @"poWorklistQuery.xsjs?cmd=getTotalOrders&groupby=PARTNERCITY¤cy=USD&filterterms="; break; default: break; } // @"http://" + host + @":80" + instance + @"/sap/hana/xs/ide/"; // _urlEpmBase + string.Format(_urlEpm_RejectOnePO, // GetPoFieldName(EpmPoFieldName.PurchaseOrderId), poDoc); return url; }
private void StartGame() { // tell Unity not to destroy our gamestate instance when we load a new scene, so that it will persist between scene transitions. // calling gamestate.Instance creates the singleton DontDestroyOnLoad(GameManager.Instance); // force offline if we're running gameplay scene directly, and not going via login screen if (_isRunImmediatelySkipGui && !GameLogin.IsCalledFromLoginScreen) { print("WARNING: Forcing offline mode, scene run without GameLogin scene"); _hanaVersion = HanaVersion.v1_00_60; _epmIsOfflineToEdit = true; GameManager.Instance.SetOffineMode(true); } // start new game state GameManager.Instance.StartNewGameState(_hanaVersion, _epmHostToEdit, _epmInstanceToEdit, _usernameToEdit, _passwordToEdit, _epmIsOfflineToEdit, _sceneToLoadWhenFinished); }
private void SetDefaults() { _connLog = ""; // get values from PlayerPrefs if possible _epmHostToEdit = PlayerPrefs.GetString("host", _epmHostDefault); _epmInstanceToEdit = PlayerPrefs.GetString("instance", _epmInstanceDefault); _usernameToEdit = PlayerPrefs.GetString("username", _usernameDefault); _passwordToEdit = _passwordDefault; // dont store pwd _hanaVersion = HanaVersion.Unknown; #if !UNITY_EDITOR _epmIsOfflineToEdit = false; #endif }
private void OnVerDetReturned(object sender, VerDetEventArgs vdea) { HanaVersion hv = vdea.HanaVer; WwwResponse r = GameManager.Instance.GetConnResponse_VerDet(hv); if (String.IsNullOrEmpty(r.WwwError)) { // Version determination was ok _hanaVersion = hv; ConnLog("Version " + hv.ToString() + " is supported"); // Checks are now complete _connCheckState = ConnCheckState.CheckPassed; ConnLog("Checks complete, please press Start button!"); _isItOkToPressPlayButton = true; } else { // Check failed, either start a new version check or if we have exhausted // supported versions then report failure switch (hv) { case HanaVersion.v1_00_60: ConnLog("HANA version is not supported"); _connCheckState = ConnCheckState.CheckFailed; break; case HanaVersion.v1_00_70: // Trigger the next version check ConnLog("Check for version " + HanaVersion.v1_00_60.ToString()); GameManager.Instance.GetConnData_VerDet(HanaVersion.v1_00_60, _epmHostToEdit, _epmInstanceToEdit); break; case HanaVersion.v1_00_72: // Trigger the next version check ConnLog("Check for version " + HanaVersion.v1_00_70.ToString()); GameManager.Instance.GetConnData_VerDet(HanaVersion.v1_00_70, _epmHostToEdit, _epmInstanceToEdit); break; default: break; } } }