void OnChargeBtn(GameObject go) { foreach (ChargeInfo chargeInfo in _chargeInfos) { if (go == chargeInfo.chargeBtn) { if (chargeInfo.monthCardId != 0) { return; } // GHome.GetInstance().Pay("", BundleGlobal.AppVersion()["Area"], chargeInfo.productCode, "", (code, msg, data) => { if (code == Constants.ERROR_CODE_SUCCESS) { } else { } }); return; } } }
void Init_GHOME_GPUSH() { if (!SDGlobal.gHomeInitialize) { SDGlobal.phoneNumber = "+86-15801772268"; SDGlobal.gHomeInitialize = true; Debug.Log("GHome Initialize"); GHome.GetInstance().Initialize("791000015", (code, msg, data) => { Debug.Log("Initialize callback code: " + code + " msg: " + msg); if (code == 0) { SDGlobal.gHomeLoginActivate = true; GHOME_CODE = 0; } else { SDGlobal.gHomeLoginActivate = false; GHOME_CODE = 1; } }); } }
void GetGHomeProductList() { GHome.GetInstance().GetProductConfig((code, msg, data) => { if (code == 0) { sdMallManager.Instance.m_gHomeProducts.Clear(); string json = (string)data["data"]; JsonNode jsonNODE = new JsonNode(); int iPOS = 0; jsonNODE.Parse(json, ref iPOS); List <JsonNode> lstAREA = new List <JsonNode>(); jsonNODE.FindListHasAttibuteName("product_code", lstAREA); foreach (JsonNode js in lstAREA) { sdMallManager.GHomeProduct gHomeProduct = new sdMallManager.GHomeProduct(); gHomeProduct.ProductCode = js.Attribute("product_code"); gHomeProduct.ItemName = js.Attribute("item_name"); gHomeProduct.price = int.Parse(js.Attribute("money")); gHomeProduct.type = int.Parse(js.Attribute("type")); sdMallManager.Instance.m_gHomeProducts.Add(gHomeProduct.ProductCode, gHomeProduct); } GHOME_CODE = 1; } else { SDGlobal.Log("GHome.GetInstance().GetProductConfig() failure"); GHOME_CODE = -2; } }); }
public static GHome GetInstance() { if (_Instance == null) { _Instance = new GHome(); } return(_Instance); }
void OnClick() { if (gameObject.name == "bt_StartGame") { EnterGame(); } else if (gameObject.name == "bt_PlayVideo") { GameObject mainCamera = GameObject.Find("@MainCamera"); if (mainCamera != null && (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)) { sdMovieVideo movie = mainCamera.GetComponent <sdMovieVideo>(); if (movie != null) { movie.PlayMovie("DS_intro.mp4"); } } //sdUICharacter.Instance.ShowMsgLine("错误提示测试!",MSGCOLOR.Red); } else if (gameObject.name == "bt_Username") { Debug.Log("bt_Username button onclick"); sdUICharacter.Instance.HideLoginMsg(); GameObject goUIRoot = GameObject.Find("UI Root (2D)"); if (goUIRoot) { Debug.Log("Find ui root"); GHome.GetInstance().Logout((code, msg, data) => { Debug.Log("GHome logout callback code: " + code + "msg: " + msg); if (code == 0) { LoginUI loginUI = goUIRoot.GetComponent <LoginUI>(); loginUI.Relogin(); } }); } gameObject.SetActive(false); } else if (gameObject.name == "bt_Server") { List <JsonNode> lst = SDNetGlobal.m_lstSrvInfo; if (lst.Count > 0) { sdUICharacter.Instance.ShowSelectSrvWnd(true); } } }
void LoginGHome(bool bActiveUI) { GHome.GetInstance().Login((code, msg, data) => { Debug.Log("Login callback code: " + code + " msg: " + msg); if (code == 0) { GHome.GetInstance().LoginArea(BundleGlobal.AppVersion()["Area"]); Debug.Log("CallBack Success."); SDGlobal.phoneNumber = (string)data["userId"]; SDGlobal.ticket = (string)data["ticket"]; if (bActiveUI) { if (m_btEnterGameButton) { m_btEnterGameButton.SetActive(true); } if (m_btGameServer) { m_btGameServer.SetActive(true); } if (m_btSystemNotice) { m_btSystemNotice.SetActive(true); } if (m_btPlayVideo) { string str = sdConfDataMgr.Instance().GetSetting("firstEnter"); m_btPlayVideo.SetActive(str.Length != 0); } } if (m_gHomeAccountButton) { if (bActiveUI) { m_gHomeAccountButton.SetActive(true); } UILabel buttonLabel = m_gHomeAccountButton.GetComponentInChildren <UILabel>(); if (buttonLabel) { //buttonLabel.text = SDGlobal.phoneNumber.Replace("+86", ""); } } Debug.Log("CallBack Success. OK!"); GHOME_CODE = 0; } else if (code == -1) { Debug.Log("code == -1"); //GHOME_CODE = -1; } else { SDGlobal.gHomeLoginActivate = true; GHOME_CODE = 1; Debug.Log("Login Error Code=" + code); } }); }