void ClickLabelBack(GameObject go) { if (GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneType != SceneType.SCUFFLEFIELD) { GameCenter.messageMng.AddClientMsg(405); return; } string url = labText.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(url)) { string[] urlStr = url.Split('|'); if (urlStr.Length == 3) { switch (urlStr[0]) { case "0": break; case "1": //跳到一级界面 GUIType uiType = (GUIType)Enum.Parse(Type.GetType("GUIType"), urlStr[2]); if (uiType == GUIType.NEWMALL && curEquipmentInfo != null) { GameCenter.buyMng.OpenBuyWnd(curEquipmentInfo); } else { GameCenter.uIMng.SwitchToUI(uiType); } ToolTipMng.CloseAllTooltip(); break; case "2": //跳到二级界面 SubGUIType subUiType = (SubGUIType)Enum.Parse(Type.GetType("SubGUIType"), urlStr[2]); GameCenter.uIMng.SwitchToSubUI(subUiType); ToolTipMng.CloseAllTooltip(); break; case "3": int npcID = 0; if (int.TryParse(urlStr[2], out npcID)) { ToolTipMng.CloseAllTooltip(); GameCenter.uIMng.SwitchToUI(GUIType.NONE); GameCenter.taskMng.PublicTraceToNpc(npcID); } break; } } else { Debug.Log("数据错误!"); } } Debug.Log("url:" + url); }
public static UIEventListener.VoidDelegate AddLink(UILabel lbl, Action <object> handler) { if (clickDic.ContainsKey(lbl.gameObject)) { Dictionary <Action <object>, UIEventListener.VoidDelegate> dic = clickDic[lbl.gameObject]; if (dic.ContainsKey(handler)) { return(null); } } else { clickDic.Add(lbl.gameObject, new Dictionary <Action <object>, UIEventListener.VoidDelegate>()); AddPress(lbl.gameObject, OnLabelPress, lbl); AddHover(lbl.gameObject, (o, b) => { if (!b) { FuncUtil.SetCursor("CURSOR_NORMAL"); } }); } UIEventListener.VoidDelegate de = delegate(GameObject go1) { string url = lbl.GetUrlAtPosition(UICamera.lastHit.point); if (url != null) { handler.DynamicInvoke(url); } }; UIEventListener.Get(lbl.gameObject).onClick += de; clickDic[lbl.gameObject].Add(handler, de); return(de); }
public void OnClickLabelURL(UILabel component) { #if GAMEDEBUG LuaManager.Instance.AddBuglyLog("UIItemBehavior-OnClickLabelURL" + ModuleName); #endif string url = component.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(url)) { Data = url; try { LuaFunction func = LuaRoot.Instance.Lua.GetFunction("OnUIItemEvent"); func.BeginPCall(); func.Push("OnClickItemLabelURL"); func.Push(ModuleName); func.Push(component); func.Push(this); func.PCall(); func.EndPCall(); } catch (System.Exception e) { LogSystem.Instance.Error("UIItemModule Call OnClickLabelURL Error:" + ModuleName + "-" + ItemName + "-" + component.name + e.ToString()); } } }
void OnClick() { UILabel lbl = GetComponent <UILabel>(); if (lbl != null) { string url = lbl.GetUrlAtPosition(UICamera.lastHit.point); if (!string.IsNullOrEmpty(url)) { string [] typs = url.Split(','); if (int.Parse(typs[0]) == 4) { if (int.Parse(typs[1]) == GamePlayer.Instance.InstId) { return; } tipsObj.SetActive(true); HaoyouShezhi hs = tipsObj.GetComponent <HaoyouShezhi>(); hs.insetId = uint.Parse(typs[1]); hs.name = typs[2]; } } } }
void OnClick() { UILabel lbl = GetComponent <UILabel>(); string url = lbl.GetUrlAtPosition(UICamera.lastWorldPosition); Application.OpenURL(url); }
static int GetUrlAtPosition(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes<UnityEngine.Vector2>(L, 2)) { UILabel obj = (UILabel)ToLua.CheckObject<UILabel>(L, 1); UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); string o = obj.GetUrlAtPosition(arg0); LuaDLL.lua_pushstring(L, o); return 1; } else if (count == 2 && TypeChecker.CheckTypes<UnityEngine.Vector3>(L, 2)) { UILabel obj = (UILabel)ToLua.CheckObject<UILabel>(L, 1); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); string o = obj.GetUrlAtPosition(arg0); LuaDLL.lua_pushstring(L, o); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UILabel.GetUrlAtPosition"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } }
static public int GetUrlAtPosition(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(UnityEngine.Vector2))) { UILabel self = (UILabel)checkSelf(l); UnityEngine.Vector2 a1; checkType(l, 2, out a1); var ret = self.GetUrlAtPosition(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 2, typeof(UnityEngine.Vector3))) { UILabel self = (UILabel)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); var ret = self.GetUrlAtPosition(a1); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static int GetUrlAtPosition(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UILabel), typeof(LuaTable))) { UILabel obj = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel"); Vector2 arg0 = LuaScriptMgr.GetVector2(L, 2); string o = obj.GetUrlAtPosition(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(UILabel), typeof(LuaTable))) { UILabel obj = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel"); Vector3 arg0 = LuaScriptMgr.GetVector3(L, 2); string o = obj.GetUrlAtPosition(arg0); LuaScriptMgr.Push(L, o); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UILabel.GetUrlAtPosition"); } return(0); }
private void OnClick() { if (label.GetUrlAtPosition(UICamera.lastWorldPosition) == "update") { Application.OpenURL(downloadsPageLink); } }
static public void ShowTag(this UILabel label) { string msg = label.GetUrlAtPosition(UICamera.lastWorldPosition); if (string.IsNullOrEmpty(msg) == true) { return; } Tooltip.Instance.ShowTooltip(eTooltipMode.TagCharacter, msg); }
private void OnClick() { UILabel component = base.GetComponent <UILabel>(); if (component != null) { string urlAtPosition = component.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(urlAtPosition)) { Application.OpenURL(urlAtPosition); } } }
void OnClick() { UILabel lbl = GetComponent <UILabel>(); if (lbl != null) { string url = lbl.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(url)) { Application.OpenURL(url); } } }
public void ClickContent() { string url = Content_detail.GetUrlAtPosition(UICamera.lastHit.point); if (!string.IsNullOrEmpty(url)) { JObject json = new JObject(); json["type"] = NetworkProtocol.GetFileInPost; json["post_no"] = no; json["file_no"] = url.Replace("file-", ""); NetworkMain.SendMessage(json); } }
void OnClick() { if (labEquip == null) { return; } string typeStr = labEquip.GetUrlAtPosition(UICamera.lastWorldPosition); int type = 0; if (int.TryParse(typeStr, out type)) { ToolTipMng.ShowEquipmentTooltip(type); } }
private void OnClick() { string url = label.GetUrlAtPosition(UICamera.lastWorldPosition); if (url == "update") { Application.OpenURL(downloadsPageLink); } else if (url == "log") { string containingDirectory = Path.GetDirectoryName(Application.consoleLogPath); System.Diagnostics.Process.Start(containingDirectory); } }
/// <summary> /// 获取鼠标点击处label文本中包含的url字符串 /// </summary> /// <param name="lbl"></param> /// <returns></returns> private string getUrl(UILabel lbl) { if (lbl != null) { //Camera currentCamera = UICamera.currentCamera; //Vector3 point = currentCamera.ScreenToWorldPoint(Input.mousePosition); //Debug.Log(point); //return lbl.GetUrlAtPosition(point); return(lbl.GetUrlAtPosition(UICamera.lastHit.point)); } else { return(null); } }
void OnClick() { UILabel lbl = GetComponent <UILabel>(); if (lbl != null) { string url = lbl.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(url)) { //ToolLog.Log(LogUser.All, "ÌøתÖÁ: " + url); Application.OpenURL(url); } } }
/// <summary> /// 获得Name对应链接参数 /// </summary> /// <param name="pos"></param> /// <returns></returns> public string GetNameUrlAtPostion(Vector3 pos) { string value = string.Empty; if (m_labelName != null) { value = m_labelName.GetUrlAtPosition(pos); if (!string.IsNullOrEmpty(value)) { return(value); } } return(value); }
void OnClick() { UILabel lbl = GetComponent <UILabel>(); if (lbl != null) { string url = lbl.GetUrlAtPosition(UICamera.lastHit.point); if (!string.IsNullOrEmpty(url)) { if (goToTask != null) { goToTask(url); } } } }
void OnClick() { UILabel lbl = GetComponent <UITextList>().textLabel; if (lbl != null) { string url = lbl.GetUrlAtPosition(UICamera.lastHit.point); if (!string.IsNullOrEmpty(url)) { //Application.OpenURL(url); // Debug.LogError (url); string[] str = url.Split('|'); doSomething(str[0], str[1], str[2]); } } }
/*(uniform resource locator) URL * 统一资源定位地址,URL 地址,一个网站地址 */ void OnClick() { UILabel lbl = GetComponent <UILabel>(); //将当前所挂脚本对象的UILabel组件赋值给UILabel对象 if (lbl != null) //如果对象上存在UILabel组件 { //在指定的世界空间位置下直接检索URL string url = lbl.GetUrlAtPosition(UICamera.lastHit.point); //射线撞击碰撞体的世界坐标中的冲击点,lastHit对2D碰撞体无效 if (!string.IsNullOrEmpty(url)) //如果网址不为空 { //TODO 重要: {[url=http://www.baidu.com/] [u] "新用户注册" [/u][/url]} 这是在Text里贴网址的方法 Application.OpenURL(url);//在浏览器中打开url(网址)。 Debug.Log("你点击了我"); } } }
void OnClick() { UILabel lbl = GetComponent <UILabel>(); if (lbl != null) { string url = lbl.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(url)) { if (onClickURL != null && onClickURL.GetPersistentEventCount() > 0) { currentURL = url; onClickURL.Invoke(); currentURL = null; } } } }
public static int GetUrlAtPosition(IntPtr l) { int result; try { int total = LuaDLL.pua_gettop(l); if (LuaObject.matchType(l, total, 2, typeof(Vector2))) { UILabel uILabel = (UILabel)LuaObject.checkSelf(l); Vector2 localPos; LuaObject.checkType(l, 2, out localPos); string urlAtPosition = uILabel.GetUrlAtPosition(localPos); LuaObject.pushValue(l, true); LuaObject.pushValue(l, urlAtPosition); result = 2; } else if (LuaObject.matchType(l, total, 2, typeof(Vector3))) { UILabel uILabel2 = (UILabel)LuaObject.checkSelf(l); Vector3 worldPos; LuaObject.checkType(l, 2, out worldPos); string urlAtPosition2 = uILabel2.GetUrlAtPosition(worldPos); LuaObject.pushValue(l, true); LuaObject.pushValue(l, urlAtPosition2); result = 2; } else { LuaObject.pushValue(l, false); LuaDLL.pua_pushstring(l, "No matched override function to call"); result = 2; } } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
/// <summary> /// 点击链接文字 /// </summary> public static void SetUrlCallback(UILabel _lab, Action <string> _callUrl) { string url = _lab.GetUrlAtPosition(UICamera.lastWorldPosition); BoxCollider box = _lab.GetComponent <BoxCollider>(); if (box == null) { box = _lab.gameObject.AddComponent <BoxCollider>(); box.size = new Vector3(_lab.localSize.x, _lab.localSize.y, 0); } UIEventListener.Get(_lab.gameObject).onClick = (x) => { if (!string.IsNullOrEmpty(url)) { if (_callUrl != null) { _callUrl(url); } } }; Debug.Log(url); }
void OnClick() { UILabel lbl = GetComponent <UILabel>(); if (lbl != null) { try { string s = lbl.GetUrlAtPosition(UICamera.lastWorldPosition); if (string.IsNullOrEmpty(s)) { return; } int code = int.Parse(s); ((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack, "", true); } catch (System.Exception e) { Debug.Log(e); } } }
public void OnClick() { string msg = m_MainLabel.GetUrlAtPosition(UICamera.lastWorldPosition); if (string.IsNullOrEmpty(msg) == true) { return; } switch (msg) { case "Character": item_delegate(this); break; case "Profile": nickname_delegate(this); break; default: break; } }
// 이벤트 : 클릭 이벤트 void OnCliSH() { if (null == m_pLabel) { return; } var strURL = m_pLabel.GetUrlAtPosition(UICamera.lastHit.point); if (true == string.IsNullOrEmpty(strURL)) { return; } if (true == m_bIsAutoOpenURL) { Application.OpenURL(strURL); } SHUtils.ForToList(m_pEvent, (pEvent) => { pEvent(strURL); }); }
/// <summary> /// 得到鼠标点击/悬浮处的URL内容 /// </summary> /// <returns>失败返回<c>null</c></returns> public static string GetUrlTouch(this UILabel label) { return(label != null?label.GetUrlAtPosition(UICamera.lastHit.point) : null); }
public void ProcessUrlClick(UILabel label) { string urlAtPosition = label.GetUrlAtPosition(UICamera.lastHit.point); if (string.IsNullOrEmpty(urlAtPosition)) { return; } try { Uri uri = new Uri(urlAtPosition); GameUIManager.mInstance.ShowGUIWebViewPopUp(uri.AbsoluteUri, Singleton<StringManager>.Instance.GetString("keFuZhuanQu")); } catch { string wordAtPosition = label.GetWordAtPosition(UICamera.lastHit.point); global::Debug.Log(new object[] { "Clicked on: " + wordAtPosition }); this.AddElfQuestLine(new ElfQuestItem { strQuest = urlAtPosition, strShow = wordAtPosition }); this.RefreshChatPanel(); this.lastQueryQuest = urlAtPosition; GameUIFairyTalePopUp.HttpGetElfQueryUrl(1510, urlAtPosition); } }
void OnClickBroadCast(UILabel label) { string url = null; bool isMiniChat = false; if (label != null)// && BigChatPopup.localPosition == Vector3.zero //큰 팝업 켜져있는지 { url = label.GetUrlAtPosition(UICamera.lastHit.point); //url = BigTextList[(uint)CurChatType].textLabel.GetUrlAtPosition(UICamera.lastHit.point); } else//작은 팝업이 켜져있음 { url = MiniTextList.textLabel.GetUrlAtPosition(UICamera.lastHit.point); isMiniChat = true; } if (!TownState.TownActive || string.IsNullOrEmpty(url)) { if (isMiniChat)//유알엘이 아니였음 큰 팝업으로 간주함 { OnClickBigChatPopup(); } return; } //Debug.Log("chat click url " + url); if (url.Contains("colosseum")) { string[] split = url.Split(','); long roomId = 0; if (split.Length < 1 || !long.TryParse(split[1], out roomId)) { Debug.LogError("Colosseum URL Parse error! " + url); return; } NetworkClient.instance.SendPMsgColosseumEnterRoomC(roomId); } else if (url.Contains("multyRaid")) { string[] split = url.Split(','); long roomId = 0; if (split.Length < 1 || !long.TryParse(split[1], out roomId)) { Debug.LogError("Colosseum URL Parse error! " + url); return; } NetworkClient.instance.SendPMsgMultiBossEnterRoomC(roomId); } else if (url.Contains("item")) { string[] split = url.Split('/'); if (split.Length < 1) { Debug.LogError("Item URL pase error! " + url); return; } Debug.Log(url); string[] equipInfo = split[1].Split(','); int unId = int.Parse(equipInfo[0]); //int unBasicValue = int.Parse(equipInfo[1]); int unAttack = int.Parse(equipInfo[1]); int unEnchantTime = int.Parse(equipInfo[2]); string[] optionInfo = split[2].Split('|'); List <NetData.ItemAbilityData> abilityList = new List <NetData.ItemAbilityData>(); NetData._ItemData itemData = new NetData._ItemData((ulong)unId, (uint)unId, (ushort)unEnchantTime, 0, 0, (uint)unAttack); //Item.ItemValueInfo basicInfo = _LowDataMgr.instance.GetLowDataItemValueInfo(itemData.GetEquipLowData().BasicOptionIndex); //if (basicInfo != null) //{ // NetData.ItemAbilityData abilityData = new NetData.ItemAbilityData(); // abilityData.Ability = (AbilityType)basicInfo.OptionId; // abilityData.Value = unBasicValue; // abilityList.Add(abilityData); //} for (int i = 0; i < optionInfo.Length; i++) { string[] ability = optionInfo[i].Split(','); uint id = uint.Parse(ability[0]); float value = float.Parse(ability[1]); Item.ItemValueInfo itemValue = _LowDataMgr.instance.GetLowDataItemValueInfo(id); abilityList.Add(new NetData.ItemAbilityData(itemValue.OptionId, value)); } itemData.StatList = abilityList; UIMgr.OpenDetailPopup(this, itemData, GetComponent <UIPanel>().depth + 3); } }
void ClickLabelBack(GameObject go) { if (chatinfo == null) { return; } if (labText == null) { return; } string url = labText.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(url)) { string[] urlStr = url.Split('|'); if (urlStr.Length == 2) { if (urlStr[0].Equals("1")) { if (urlStr[1].Equals("0")) { if (chatinfo.playerID.Count > 0) { GameCenter.previewManager.C2S_AskOPCPreview(chatinfo.playerID[0]); } } if (urlStr[1].Equals("1")) { if (chatinfo.playerID.Count > 1) { GameCenter.previewManager.C2S_AskOPCPreview(chatinfo.playerID[1]); } } } if (urlStr[0].Equals("2")) { if (urlStr[1].Equals("0")) { if (chatinfo.equipmentRefList.Count > 0) { if (chatinfo.equipmentRefList[0] != null) { ToolTipMng.ShowEquipmentTooltip(chatinfo.equipmentRefList[0], ItemActionType.None, ItemActionType.None, ItemActionType.None, ItemActionType.None, this.gameObject); } } } if (urlStr[1].Equals("1")) { if (chatinfo.equipmentRefList.Count > 1) { if (chatinfo.equipmentRefList[1] != null) { ToolTipMng.ShowEquipmentTooltip(chatinfo.equipmentRefList[1], ItemActionType.None, ItemActionType.None, ItemActionType.None, ItemActionType.None, this.gameObject); } } } } if (urlStr[0].Equals("3")) { if (urlStr[1].Equals("0")) { if (chatinfo.equipmentList.Count > 0) { if (chatinfo.equipmentList[0] != null) { ToolTipMng.ShowEquipmentTooltip(chatinfo.equipmentList[0], ItemActionType.None, ItemActionType.None, ItemActionType.None, ItemActionType.None, this.gameObject); } } } if (urlStr[1].Equals("1")) { if (chatinfo.equipmentList.Count > 1) { if (chatinfo.equipmentList[1] != null) { ToolTipMng.ShowEquipmentTooltip(chatinfo.equipmentList[1], ItemActionType.None, ItemActionType.None, ItemActionType.None, ItemActionType.None, this.gameObject); } } } } if (urlStr[0].Equals("4")) { if (chatinfo.sceneID != 0 && chatinfo.point != Vector3.zero) { GameCenter.curMainPlayer.GoTraceTarget(chatinfo.sceneID, (int)chatinfo.point.x, (int)chatinfo.point.z); willCloseChatWnd = true; } } if (urlStr[0].Equals("5")) { if (chatinfo.EquipInfo != null) { ToolTipMng.ShowEquipmentTooltip(chatinfo.EquipInfo, ItemActionType.None, ItemActionType.None, ItemActionType.None, ItemActionType.None, this.gameObject); } else { Debug.LogError("查看的物品数据为空 by黄洪兴"); } } if (urlStr[0].Equals("6")) { if (chatinfo != null) { Vector3 point = GameCenter.cameraMng.uiCamera.ScreenToWorldPoint(Input.mousePosition); if (GameCenter.chatMng.OnShowInformation != null) { GameCenter.chatMng.OnShowInformation(chatinfo, point); } } } if (urlStr[0].Equals("7")) { if (chatinfo != null) { int oth_id = GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID; if (!GameCenter.teamMng.isInTeam) { if (!GameCenter.duplicateMng.CopyTeams.ContainsKey(oth_id) && GameCenter.duplicateMng.CopyTeams.Count < 3) { if (chatinfo.playerID.Count > 0) { GameCenter.duplicateMng.C2S_CopyInFriendReturn(chatinfo.playerID[0], 2); GameCenter.duplicateMng.isMagicTowrAddFri = true; } } else { GameCenter.messageMng.AddClientMsg(84); } } else { GameCenter.messageMng.AddClientMsg(423); } } } } else { Debug.Log("数据错误!" + "url:" + url); } } }