public void Awake(GObject go) { if (go == null) { return; } GObject = go; if (string.IsNullOrWhiteSpace(Name)) { Name = Id.ToString(); } self = (GComponent)go; self.Add(this); var com = go.asCom; if (com != null) { cost_bg = (GImage)com.GetChildAt(3); cost_txt = (GTextField)com.GetChildAt(4); effect_txt = (GRichTextField)com.GetChildAt(5); attack_txt = (GTextField)com.GetChildAt(6); hp_txt = (GTextField)com.GetChildAt(7); size_bg = (GImage)com.GetChildAt(8); size_txt = (GTextField)com.GetChildAt(9); } }
public void Init() { valueMonitorPool.Clear(); ui = gameObject.GetComponent <UIPanel>().ui; choiceframe = ui.GetChild("choiceframe").asCom; swordchoice = choiceframe.GetChild("swordchoice").asCom; choice0 = choiceframe.GetChild("n0").asRichTextField; choice1 = choiceframe.GetChild("n1").asRichTextField; choice2 = choiceframe.GetChild("n2").asRichTextField; choice3 = choiceframe.GetChild("n3").asRichTextField; choice4 = choiceframe.GetChild("n4").asRichTextField; choicelist.Add(choice0); choicelist.Add(choice1); choicelist.Add(choice2); choicelist.Add(choice3); choicelist.Add(choice4); choiceframe.visible = false; choiceindex = 0; valueMonitorPool.AddMonitor(() => { return(choiceindex); }, (int from, int to) => { FocusIndex(choiceindex); }); alphachoice(0); }
public void Awake(GObject go) { if (go == null) { return; } GObject = go; if (string.IsNullOrWhiteSpace(Name)) { Name = Id.ToString(); } self = (GComponent)go; self.Add(this); var com = go.asCom; if (com != null) { speakerTxt = (GRichTextField)com.GetChildAt(1); btnList = (GList)com.GetChildAt(2); } }
// Use this for initialization void Start() { Application.targetFrameRate = 60; _mainView = this.GetComponent <UIPanel>().ui; // 主UI界面 GRichTextField richText = _mainView.GetChild("name").asRichTextField; richText.text = "[color=#ff4400]hello[/color]"; Transform npc = GameObject.Find("npc1").transform; UIPanel panel = npc.FindChild("HeadBar").GetComponent <UIPanel>(); GRichTextField richTextNpc1 = panel.ui.GetChild("name").asRichTextField; richTextNpc1.text = "Long [color=#FFFFFF]LongName[/color]<a href='http://www.baidu.com><img src='ui://21gc3jcpoi6k4'/></a> Name"; //<a href=’xx><img src=’yy’/></a> richTextNpc1.onClickLink.Add(() => { Debug.Log("click rich text img "); }); panel.ui.GetChild("blood").asProgress.value = 80; panel.ui.GetChild("sign").asLoader.url = UIPackage.GetItemURL("HeaderBar", "task"); npc = GameObject.Find("npc2").transform; panel = npc.FindChild("HeadBar").GetComponent <UIPanel>(); panel.ui.GetChild("name").text = "Man2"; panel.ui.GetChild("blood").asProgress.value = 20; panel.ui.GetChild("sign").asLoader.url = UIPackage.GetItemURL("HeaderBar", "fighting"); }
/// <summary> /// 设置字体组件值 /// </summary> /// <param name="gRichTextField"></param> public static void SetGRichTextByCode(this GRichTextField gRichTextField, string code) { if (!string.IsNullOrEmpty(code)) { CentorPivot.This.GetComponent <LocalizationComponent>().SetGRichTextByCode(gRichTextField, code); } }
public static void Parse(GRichTextField tf, string text) { tf.emojies = EmojiTools.GetEmojis(); //给富文本设置emoji包 tf.width = tf.initWidth; tf.text = EmojiParser.inst.Parse(text); //解析string替换Emoji表情 tf.width = tf.textWidth; //宽度自适应 }
public void Awake() { Game.Scene.GetComponent <FUIPackageComponent>().AddPackage("OverHead"); this.m_tank = this.GetParent <Tank>(); this.m_overHeadGO = this.m_tank.GameObject.FindChildObjectByPath("OverHead"); this.m_overHeadGO.SetActive(true); this.m_uiPanel = this.m_overHeadGO.GetComponent <UIPanel>(); this.m_name = this.m_uiPanel.ui.GetChild("name").asRichTextField; this.m_redBar = this.m_uiPanel.ui.GetChild("n0").asProgress; this.m_whiteBar = this.m_uiPanel.ui.GetChild("n1").asProgress; this.m_name.text = this.m_tank.Name; m_numericComponent = this.m_tank.GetComponent <NumericComponent>(); this.m_redBar.max = m_numericComponent[NumericType.MaxHp]; this.m_redBar.value = m_numericComponent[NumericType.Hp]; this.m_whiteBar.max = 100; this.m_whiteBar.value = 100; if (this.m_tank.TankCamp != TankComponent.Instance.MyTank.TankCamp) { this.m_name.color = Color.red; } }
public override void ConstructFromXML(FairyGUI.Utils.XML xml) { base.ConstructFromXML(xml); iconCon = this.GetController("c1"); tipText = this.GetChild("tipText").asRichTextField; trans = this.GetTransition("t0"); moneyText = this.GetChild("n11").asTextField; }
public override void ConstructFromXML() { this.Owner = "FUI.Login"; m_Ctrl_Content = this.GetController("Ctrl_Content"); m_Text_Protocol_Content_User = (GRichTextField)this.GetChild("Text_Protocol_Content_User"); m_Text_Protocol_Content_Privacy = (GRichTextField)this.GetChild("Text_Protocol_Content_Privacy"); }
public override void ConstructFromXML() { this.Owner = "FUI.Login"; m_Text_Number_Item = (GTextField)this.GetChild("Text_Number_Item"); m_Button_Close_X2 = (GButton)this.GetChild("Button_Close_X2"); m_Text_Date = (GTextField)this.GetChild("Text_Date"); m_Text_Icon = (GRichTextField)this.GetChild("Text_Icon"); }
void Start() { var ui = GetComponent <UIPanel>().ui; textField = ui.GetChild("n2").asRichTextField; bg = ui.GetChild("n1").asImage; jiao = ui.GetChild("n0").asImage; tiaozheng(); }
public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); m_BaseWindow = (WindowFrame)this.GetChildAt(0); m_Acount = (BasicInput)this.GetChildAt(1); m_Password = (BasicPassword)this.GetChildAt(2); m_LoginButton = (GreenButton)this.GetChildAt(3); m_HtmlText = (GRichTextField)this.GetChildAt(4); }
//------------------------------ private void PlayText() { GComponent obj = _demoObjects["Text"]; //!!注意这里是fairygui.event.TextEvent而不是flash.events.TextEvent obj.GetChild("n12").asRichTextField.onClickLink.Add((EventContext context) => { GRichTextField t = context.sender as GRichTextField; t.text = "[img]ui://9leh0eyft9fj5f[/img][color=#FF0000]你点击了链接[/color]:" + context.data; }); }
public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); m_BaseWindow = (WindowFrame)this.GetChildAt(0); m_Next = (OrangeButton)this.GetChildAt(1); m_RoleList = (GList)this.GetChildAt(2); m_Detials = (BasicText)this.GetChildAt(3); m_HintText = (BasicText)this.GetChildAt(4); m_IconLoader = (IconLoader)this.GetChildAt(5); m_htmlText = (GRichTextField)this.GetChildAt(6); }
//------------------------------ private void PlayText() { GComponent obj = _demoObjects["Text"]; obj.GetChild("n12").asRichTextField.onClickLink.Add((EventContext context) => { GRichTextField t = context.sender as GRichTextField; t.text = "[img]ui://9leh0eyft9fj5f[/img][color=#FF0000]You click the link[/color]:" + context.data; }); obj.GetChild("n25").onClick.Add(() => { obj.GetChild("n24").text = obj.GetChild("n22").text; }); }
public override void ConstructFromXML() { this.Owner = "FUI.Login"; m_Text_Account_Input = (GTextInput)this.GetChild("Text_Account_Input"); m_Text_GD_Protocol_More = (GRichTextField)this.GetChild("Text_GD_Protocol_More"); m_Text_Code_Input = (GTextInput)this.GetChild("Text_Code_Input"); m_Button_Guest = (Button_Guest)this.GetChild("Button_Guest"); m_Button_SendCode = (Button_SendCode)this.GetChild("Button_SendCode"); m_Button_Close_X3 = (GButton)this.GetChild("Button_Close_X3"); m_Button_Choose = (GButton)this.GetChild("Button_Choose"); m_Button_OtherMethods = (Button_OtherMethods)this.GetChild("Button_OtherMethods"); m_CBox_SelectNumber = (CBox_SelectNumber)this.GetChild("CBox_SelectNumber"); m_CBox_NumberArea = (CBox_NumberArea)this.GetChild("CBox_NumberArea"); }
public override void Dispose() { if (IsDisposed) { return; } base.Dispose(); self.Remove(); self = null; speakerTxt = null; btnList = null; }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("UIMain", "GetNewItem").asCom; this.Center(); this.modal = true; _new_item_list = this.contentPane.GetChild("list").asList; _new_item_list.EnsureBoundsCorrect(); _confirm = this.contentPane.GetChild("confirm").asButton; _confirm.onClick.Add(chooseItem); _confirm.visible = false; _skip = this.contentPane.GetChild("skip").asRichTextField; _skip.onTouchBegin.Add(skip); }
void RenderListItem(int index, GObject obj) { GButton item = (GButton)obj; Message msg = _messages[index]; if (!msg.fromMe) { item.GetChild("name").text = msg.sender; } item.icon = UIPackage.GetItemURL("Emoji", msg.senderIcon); //Recaculate the text width GRichTextField tf = item.GetChild("msg").asRichTextField; tf.emojies = _emojies; tf.text = EmojiParser.inst.Parse(msg.msg); }
private void SetTextContent(GComponent comp) { GImage TextBkg1 = comp.GetChild("n3").asImage; GImage TextBkg2 = comp.GetChild("n4").asImage; GRichTextField TextContent = comp.GetChild("n7").asRichTextField; TextBkg1.width = TextContent.textWidth + 50; TextBkg2.width = TextBkg1.width; TextContent.x = GRoot.inst.width / 2 - TextContent.textWidth / 2; TextBkg1.x = GRoot.inst.width / 2 - TextBkg1.width / 2; TextBkg2.x = GRoot.inst.width / 2 - TextBkg2.width / 2; }
void Start() { UIPackage.AddPackage("UI/EmojiDemo/EmojiDemo"); GRoot.inst.SetContentScaleFactor(1080, 1920, UIContentScaler.ScreenMatchMode.MatchWidthOrHeight); view = UIPackage.CreateObject("EmojiDemo", "EmojiDemo").asCom; view.SetSize(GRoot.inst.width, GRoot.inst.height); view.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(view); richTextField = view.GetChild("richtext").asRichTextField; string text = "An awesome string with a few 😉emojis!"; EmojiTools.Parse(richTextField, text); textInput = view.GetChild("input").asTextInput; textInput.onFocusOut.Set(() => { SendInput(); }); }
protected override void StartFUI() { m_againBtn = this.FUIComponent.Get("n10").GObject.asButton; m_leftList = this.FUIComponent.Get("n32").Get("n1").GObject.asList; m_rightList = this.FUIComponent.Get("n33").Get("n1").GObject.asList; m_leftSucOrFail = this.FUIComponent.Get("n28").GObject.asLoader; m_rightSucOrFail = this.FUIComponent.Get("n29").GObject.asLoader; m_leftCampName = this.FUIComponent.Get("n24").GObject.asRichTextField; m_rightCampName = this.FUIComponent.Get("n25").GObject.asRichTextField; m_leftTopTitle = this.FUIComponent.Get("n32").GObject.asCom.GetChild("n2").asCom; m_rightTopTitle = this.FUIComponent.Get("n33").GObject.asCom.GetChild("n2").asCom; m_againBtn.onClick.Set(this.AgainBtn_OnClick); this.m_leftList.itemRenderer = ItemRendererLeft; this.m_rightList.itemRenderer = ItemRendererRight; this.UI(); }
public void SetGRichTextByCode(GRichTextField gTextField, string code) { string pjblock = Utility.Text.Format("{0}{1}", gTextField.Owner, gTextField.Block); DictionaryInfo dictionaryInfo = RefreshGTextInfo(pjblock, code); if (dictionaryInfo != null) { gTextField.text = dictionaryInfo.Value; if (dictionaryInfo.Size > 0) { gTextField.textFormat.size = dictionaryInfo.Size; } if (dictionaryInfo.NewLine) { gTextField.text = gTextField.text.Replace("**", System.Environment.NewLine); } } }
public override void Dispose() { if (IsDisposed) { return; } base.Dispose(); self.Remove(); self = null; cost_bg = null; cost_txt = null; effect_txt = null; attack_txt = null; hp_txt = null; size_bg = null; size_txt = null; }
// Use this for initialization public void Init() { panduanindex = 0; valueMonitorPool.Clear(); gameObject.SetActive(false); ui = gameObject.GetComponent <UIPanel>().ui; RestartG = ui.GetChildWithPath("n1").asButton; RestartG.GetChild("text").text = "重新开始"; RestartG.onClick.Add(() => { GameStart.Instance.ReloadGame(); }); GameOverChoiceframe = ui.GetChild("GameOverChoiceframe").asCom; swordchoice = GameOverChoiceframe.GetChildWithPath("swordchoice").asCom; choice0 = GameOverChoiceframe.GetChild("n4").asRichTextField; choice1 = GameOverChoiceframe.GetChild("n5").asRichTextField; choicelist.Add(choice0); choicelist.Add(choice1); valueMonitorPool.AddMonitor(() => { return(panduanindex); }, (int from, int to) => { FocusIndex(panduanindex); }); alphachoice(0); choice0.onClick.Add(() => { FocusIndex(0); Restart(); }); choice1.onClick.Add(() => { FocusIndex(1); Debug.Log("out"); }); #region //关闭you die界面 UIManager.Instance.CreatSUIObj <SkeletonAnimation>("OverSpine01").gameObject.SetActive(false); UIManager.Instance.CreatSUIObj <SkeletonAnimation>("OverSpine02").gameObject.SetActive(false); #endregion }
public void AddEmitTip(string text, PopMessageType type) { EmitTip item = m_EmitTipPool.Alloc(NewEmitTip); item.Init(type); m_EmitTipItems.Add(item); this.FUIComponent.GObject.asCom.AddChild(item.m_comp); GRichTextField textContent = item.m_comp.GetChild("n7").asRichTextField; textContent.text = text; SetTextContent(item.m_comp); Transition anim = item.GetAnim(); if (anim != null) { anim.Play(); } }
void AddMsg(string sender, string senderIcon, string msg, bool fromMe) { bool isScrollBottom = _list.scrollPane.isBottomMost; GButton item = _list.AddItemFromPool(fromMe ? _itemURL2 : _itemURL1).asButton; if (!fromMe) { item.GetChild("name").text = sender; } item.icon = UIPackage.GetItemURL("Emoji", senderIcon); //Recaculate the text width GRichTextField tf = item.GetChild("msg").asRichTextField; tf.width = tf.initWidth; tf.text = EmojiParser.inst.Parse(msg); tf.width = tf.textWidth; if (fromMe) { if (_list.numChildren == 1 || Random.Range(0f, 1f) < 0.5f) { AddMsg("FairyGUI", "r1", "Today is a good day. [:gz]", false); } } if (_list.numChildren > 30) { _list.RemoveChildrenToPool(0, _list.numChildren - 30); } if (isScrollBottom) { _list.scrollPane.ScrollBottom(true); } }
public void Init() { storeController = this.gameObject.AddComponent <StoreController>(); storeController.Init(); ui = GetComponent <UIPanel>().ui; storeup = ui.GetChild("n5").asCom; //选项"是" storedown = ui.GetChild("n6").asCom; //选项"否" storebuy = ui.GetChild("n7").asCom; n1 = storeup.GetChild("left1").asLoader; //消耗品 n2 = storeup.GetChild("left2").asLoader; //武器 n3 = storeup.GetChild("left3").asLoader; //防具 n4 = storeup.GetChild("left4").asLoader; //饰品 t1 = storeup.GetChild("lefttext1").asRichTextField; t2 = storeup.GetChild("lefttext2").asRichTextField; t3 = storeup.GetChild("lefttext3").asRichTextField; t4 = storeup.GetChild("lefttext4").asRichTextField; tisheng = storeup.GetChild("tisheng").asImage; namedown = storedown.GetChild("n1").asTextField; //storedown物品名称 descdown = storedown.GetChild("n3").asTextField; //storedown物品描述 buy1 = storebuy.GetChild("n5").asLoader; buy2 = storebuy.GetChild("n6").asLoader; buytext = storebuy.GetChild("n2").asTextField; tisheng.visible = false; LeftList.Add(n1); LeftList.Add(n2); LeftList.Add(n3); LeftList.Add(n4); textlist.Add(t1); textlist.Add(t2); textlist.Add(t3); textlist.Add(t4); buylist.Add(buy1); buylist.Add(buy2); t1.onClick.Add(() => { leftindex = 0; onclick(); }); t2.onClick.Add(() => { leftindex = 1; onclick(); }); t3.onClick.Add(() => { leftindex = 2; onclick(); }); t4.onClick.Add(() => { leftindex = 3; onclick(); }); buy1.onClick.Add(() => { storebuyindex = 0; buychoice(storebuyindex); leftright = 0; storeController.closechoice(); openchoice(); storeController.choice0(); storebuy.visible = false; offFsm(); }); buy2.onClick.Add(() => { storebuyindex = 1; buychoice(storebuyindex); leftright = 1; storebuy.visible = false; }); leftchoice = storeup.GetChild("Choice").asImage; leftright = 0; leftindex = 0; storedown.visible = false; storebuy.visible = false; storeup.visible = false; storebuyfirsty = storeup.x; das = false; Hide(); storeController.onoff = (int obj) => { //leftright = obj; if (obj == 0) { //openchoice(); choiceleftpos(leftindex); AnimManager.Instance.Movesize(tisheng, leftchoice, storeController.choicevector2(), new Vector2(LeftList[leftindex].position.x + 1, LeftList[leftindex].position.y), 0.1f); } else { if (obj != leftright) { closechoice(); AnimManager.Instance.Movesize(tisheng, storeController.choice, leftchoice.position, storeController.choicenow(), 0.1f); } showbuy(); } leftright = obj; }; storeController.show = (int index) => { rightindex = index; BagData bagData; if (storeController.bagDataList.TryGet(index, out bagData)) { namedown.text = bagData.name; descdown.text = bagData.desc; } if (storeController.leftright == 0) { closestoredowntw(); } else { openstoredowntw(); } }; //iconchoice(0); choiceleftpos(leftindex); Import(); }
// Start is called before the first frame update void Start() { mainUI = GetComponent <UIPanel>().ui; roll = mainUI.GetChild("rollText").asCom; text = roll.GetChild("text").asRichTextField; }