private void Awake() { Global.Instance.scene = SceneType.MenuScene;//切换场景变量 Global.Instance.activedSceneManager = this; //尝试获取网络端口 try { cardClient = GameObject.FindGameObjectWithTag(Tags.Networks).GetComponent<CardClient>(); RequestPlayerInfo();//获取角色信息 } catch (Exception ex) { LogsSystem.Instance.Print(ex.ToString()); } //获取功能按键 //StartButton = GameObject.Find("GameStart"); //聊天窗初始化 chatList = GameObject.Find("Chatting/ChattingList").GetComponent<UITextList>(); if (chatList != null) { chatScroll = chatList.scrollBar as UIScrollBar; chatScroll.alpha = 0.01f; } //角色信息获取 coinLabel = GameObject.Find("Economy/Coin/Sprite/Num").GetComponent<UILabel>(); gemLabel = GameObject.Find("Economy/Gem/Sprite/Num").GetComponent<UILabel>(); playerNameLabel = GameObject.Find("Head/Name").GetComponent<UILabel>(); levelLabel = GameObject.Find("Head/Head-bg/Level").GetComponent<UILabel>(); //信息控件获取 //infoPanel = GameObject.Find("Frame/Background/InfoPanel"); cardListGrid = GameObject.Find("Frame/Background/InfoPanel/CardContainer/CardList/Grid"); }
private void CreateObjects() { this.btnTab = base.transform.Find("tab").GetComponent<UIToggle>(); EventDelegate.Add(this.btnTab.onChange, new EventDelegate.Callback(this.OnTabCheckChanged)); this.txtTab = this.btnTab.transform.Find("tabTxt").GetComponent<UILabel>(); this.txtTab2 = this.btnTab.transform.Find("tabCheck/tabTxt").GetComponent<UILabel>(); Transform transform = base.transform.Find("tabPanel"); this.topBtn = GameUITools.RegisterClickEvent("TopBtn", new UIEventListener.VoidDelegate(this.OnTopBtnClick), transform.gameObject); this.topBtn.SetActive(false); this.bottomBtn = GameUITools.RegisterClickEvent("BottomBtn", new UIEventListener.VoidDelegate(this.OnBottomBtnClick), transform.gameObject); this.bottomBtn.SetActive(false); this.btnsTable = transform.Find("tabBtnsPanel/tabBtns").GetComponent<UITable>(); this.scrollBar = transform.Find("scrollBar").GetComponent<UIScrollBar>(); EventDelegate.Add(this.scrollBar.onChange, new EventDelegate.Callback(this.OnScrollBarValueChange)); this.txtTab.text = this.initData.strName; this.txtTab2.text = this.initData.strName; if (this.initData.strName.Length > 2) { this.txtTab.spacingX = 5; this.txtTab2.spacingX = 5; } this.infoTable = transform.Find("bg/infoPanel/infoContents").GetComponent<UITable>(); this.infoTitle = this.infoTable.transform.Find("Label0").GetComponent<UILabel>(); this.infoTitle.spaceIsNewLine = false; this.infoContent = this.infoTable.transform.Find("Label1").GetComponent<UILabel>(); this.infoContent.spaceIsNewLine = false; UIEventListener expr_206 = UIEventListener.Get(this.infoContent.gameObject); expr_206.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_206.onClick, new UIEventListener.VoidDelegate(this.OnInfoContentClick)); }
private void CreateObjects() { Transform transform = base.transform.Find("winBg"); GameObject gameObject = transform.Find("closeBtn").gameObject; UIEventListener expr_28 = UIEventListener.Get(gameObject); expr_28.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_28.onClick, new UIEventListener.VoidDelegate(this.OnCloseBtnClick)); this.mMyJob = transform.Find("txt0/job").GetComponent<UILabel>(); this.mJobContents = transform.Find("contentsBg/contentsPanel/contents/Label").GetComponent<UILabel>(); this.mUIScrollBar = transform.Find("contentsBg/contentsScrollBar").GetComponent<UIScrollBar>(); }
private void CreateObjects() { this.mPanel = GameUITools.FindGameObject("rewardPanel", base.gameObject).GetComponent<UIPanel>(); this.mGo = GameUITools.RegisterClickEvent("Go", new UIEventListener.VoidDelegate(this.OnGoBtnClick), base.gameObject).GetComponent<UISprite>(); GameObject parent = GameUITools.FindGameObject("rewardPanel/Contents", base.gameObject); this.mTitle = GameUITools.FindUILabel("Title", parent); this.mContent = GameUITools.FindUILabel("Content", parent); this.mLine = GameUITools.FindUISprite("line", base.gameObject); this.mScrollBar = GameUITools.FindGameObject("scrollBar", base.gameObject).GetComponent<UIScrollBar>(); this.mGo.gameObject.SetActive(false); base.StartCoroutine(this.ShowBar()); }
private void Awake() { Global.Instance.scene = SceneType.MenuScene;//切换场景变量 Global.Instance.activedSceneManager = this; //尝试获取网络端口 try { cardClient = GameObject.FindGameObjectWithTag(Tags.Networks).GetComponent<CardClient>(); RequestPlayerInfo();//获取角色信息 } catch (Exception ex) { LogsSystem.Instance.Print(ex.ToString()); } //获取功能按键 //StartButton = GameObject.Find("GameStart"); //聊天窗初始化 chatList = GameObject.Find("Chatting/ChattingList").GetComponent<UITextList>(); if (chatList != null) { chatScroll = chatList.scrollBar as UIScrollBar; chatScroll.alpha = 0.01f; } //角色信息获取 coinLabel = GameObject.Find("Economy/Coin/Sprite/Num").GetComponent<UILabel>(); gemLabel = GameObject.Find("Economy/Gem/Sprite/Num").GetComponent<UILabel>(); playerNameLabel = GameObject.Find("Head/Name").GetComponent<UILabel>(); levelLabel = GameObject.Find("Head/Head-bg/Level").GetComponent<UILabel>(); //信息控件获取 //infoPanel = GameObject.Find("Frame/Background/InfoPanel"); cardListGrid = GameObject.Find("Frame/Background/InfoPanel/CardContainer/CardList/Grid"); //卡片背包面板 cardInventoryPanel = GameObject.Find("CardInventory").GetComponent<UIPanel>(); cardInventoryButtonLowlay = GameObject.Find("CardInventory/Background/Feature/Button-lowlay"); heroInfoUsingList = GameObject.Find("CardInventory/Background/Main/HeroInfo/UsingHeros/Scroll View/Grid").GetComponent<UIGrid>(); heroInfoInvList = GameObject.Find("CardInventory/Background/Main/HeroInfo/InvHeros/Scroll View/Grid").GetComponent<UIGrid>(); //卡片背包标签页 ci_PlayerInfo = GameObject.Find("CardInventory/Background/Main/PlayerInfo"); ci_HeroInfo = GameObject.Find("CardInventory/Background/Main/HeroInfo"); ci_GuideInfo = GameObject.Find("CardInventory/Background/Main/GuideInfo"); ci_InvInfo = GameObject.Find("CardInventory/Background/Main/InvInfo"); //玩家页 pp_PlayerName = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerName").GetComponent<UILabel>(); pp_PlayerLevel = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerLevel").GetComponent<UILabel>(); pp_PlayerCoin = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerCoin").GetComponent<UILabel>(); pp_PlayerGem = GameObject.Find("CardInventory/Background/Main/PlayerInfo/Head/PlayerGem").GetComponent<UILabel>(); pp_HeroGrid = GameObject.Find("CardInventory/Background/Main/PlayerInfo/CardInfo/Heros/Scroll View/Grid").GetComponent<UIGrid>(); pp_ItemGrid = GameObject.Find("CardInventory/Background/Main/PlayerInfo/CardInfo/Items/Scroll View/Grid").GetComponent<UIGrid>(); }
void Start() { //Get components from the scene at init. //Get the audio from the background, which is the slide sound. GameObject background = GameObject.FindWithTag("Background"); slideSound = background.GetComponent<UIPlaySound>(); //Get the scroll bar from the race scroll element. GameObject raceScrollBarObject = GameObject.FindWithTag("RaceScrollBar"); raceScrollBar = raceScrollBarObject.GetComponent<UIScrollBar>(); //Get the scroll bar from the ship scroll element. GameObject shipScrollBarObject = GameObject.FindWithTag("ShipScrollBar"); shipScrollBar = shipScrollBarObject.GetComponent<UIScrollBar>(); }
private void CreateObjects() { Transform transform = base.transform.Find("winBg"); GameObject gameObject = transform.Find("closeBtn").gameObject; UIEventListener expr_28 = UIEventListener.Get(gameObject); expr_28.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_28.onClick, new UIEventListener.VoidDelegate(this.OnCloseBtnClick)); this.mGuildLogTable = transform.Find("contentsBg/contentsPanel/contents").gameObject.AddComponent<GuildLogTable>(); this.mGuildLogTable.columns = 1; this.mGuildLogTable.direction = UITable.Direction.Down; this.mGuildLogTable.sorting = UITable.Sorting.Custom; this.mGuildLogTable.hideInactive = true; this.mGuildLogTable.keepWithinPanel = true; this.mGuildLogTable.padding = new Vector2(0f, 2f); this.mUIScrollBar = transform.transform.Find("contentsBg/contentsScrollBar").GetComponent<UIScrollBar>(); }
public override void InitPopUp(bool value = false) { this.needAgree = value; this.LoadAgreementTable(); GameObject parent = GameUITools.FindGameObject("winBG", base.gameObject); GameUITools.RegisterClickEvent("closeBtn", new UIEventListener.VoidDelegate(this.OnCloseClick), parent).SetActive(!this.needAgree); GameUITools.RegisterClickEvent("Previous", new UIEventListener.VoidDelegate(this.OnPreviousClick), parent); GameUITools.RegisterClickEvent("Next", new UIEventListener.VoidDelegate(this.OnNextClick), parent); GameUITools.RegisterClickEvent("Disagree", new UIEventListener.VoidDelegate(this.OnDisagreeClick), parent).SetActive(this.needAgree); GameUITools.RegisterClickEvent("Agree", new UIEventListener.VoidDelegate(this.OnAgreeClick), parent).SetActive(this.needAgree); GameUITools.FindUILabel("title", parent).text = this.GetAgreement("Title"); this.mInfo = GameUITools.FindUILabel("contentsPanel/contents/info", parent); this.mBar = GameUITools.FindGameObject("contentsScrollBar", parent).GetComponent<UIScrollBar>(); this.maxPage = this.GetAgreementCount() - 1; this.mPages = GameUITools.FindUILabel("Pages", parent); this.Refresh(); }
private void CreateObjects() { GameObject gameObject = base.transform.Find("winBG").gameObject; this.mTitle = gameObject.transform.Find("title").GetComponent<UILabel>(); this.mInfo = gameObject.transform.Find("contentsPanel/contents/info").GetComponent<UILabel>(); this.mInfo.spaceIsNewLine = false; GameObject gameObject2 = gameObject.transform.Find("closeBtn").gameObject; UIEventListener expr_74 = UIEventListener.Get(gameObject2); expr_74.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_74.onClick, new UIEventListener.VoidDelegate(this.OnCloseBtnClick)); this.mContentTable = gameObject.transform.Find("contentsPanel/contents").gameObject.AddComponent<UITable>(); this.mContentTable.columns = 1; this.mContentTable.direction = UITable.Direction.Down; this.mContentTable.sorting = UITable.Sorting.None; this.mContentTable.hideInactive = true; this.mContentTable.keepWithinPanel = true; this.mContentTable.padding = new Vector2(0f, 2f); this.mScrollBar = gameObject.transform.Find("contentsScrollBar").GetComponent<UIScrollBar>(); }
public void Init() { if (this.PushTxtDuration <= 0f) { this.PushTxtDuration = 1f; } if (this.ExpandDuration <= 0f) { this.ExpandDuration = 1f; } this.mBG = GameUITools.FindUISprite("BG", base.gameObject); this.mArrowBtn = GameUITools.RegisterClickEvent("ArrowBtn", new UIEventListener.VoidDelegate(this.OnMsgArrowBtnClick), base.gameObject).GetComponent<UISprite>(); this.mScrollBar = GameUITools.FindGameObject("BgPanelScrollBar", base.gameObject).GetComponent<UIScrollBar>(); this.mPanel = GameUITools.FindGameObject("Panel", base.gameObject).GetComponent<UIPanel>(); this.mContent = GameUITools.FindGameObject("Content", this.mPanel.gameObject).GetComponent<UITable>(); this.mMsgLabel = GameUITools.FindUILabel("MsgLabel", this.mContent.gameObject); this.mMsgLabel.text = string.Empty; }
void Start() { //Get components from the scene at init. //Get the audio from the quit button, the slide onto quit audio GameObject quitButton = GameObject.FindWithTag("QuitButton"); quitSlideSound = quitButton.GetComponent<UIPlaySound>(); //Get the audio from the start button, the default select audio GameObject startButton = GameObject.FindWithTag("StartButton"); slideSound = startButton.GetComponent<UIPlaySound>(); //Get the vertical scroll bar. GameObject verticalScrollBarObject = GameObject.FindWithTag("MainMenuScrollBar"); verticalScrollBar = verticalScrollBarObject.gameObject.GetComponent<UIScrollBar>(); //Get the audio from the background, which happens to be the select sound GameObject background = GameObject.FindWithTag("Background"); selectSound = background.GetComponent<UIPlaySound>(); }
public void AttachHorizontalScrollBar(UIScrollBar scrollBar) { horizontalScrollBar = scrollBar; horizontalScrollBar.onChange += OnHorizontalBar; horizontalScrollBar.alpha = ((showScrollBars == ShowCondition.Always) || shouldMoveHorizontally) ? 1f : 0f; UpdateScrollbars(true); }
public void Init() { this.ResetTimer = base.transform.Find("time1").GetComponent<UILabel>(); Transform transform = base.transform.Find("RewardBK"); this.Title = transform.transform.Find("Title").GetComponent<UILabel>(); this.Reward = transform.transform.Find("Reward"); this.Price = transform.transform.Find("Price").GetComponent<UILabel>(); this.OffPrice = transform.transform.Find("OffPrice").GetComponent<UILabel>(); this.BuyVIPLevel = transform.transform.Find("BuyVIPLevel").GetComponent<UILabel>(); this.CurVipLevel = transform.transform.Find("CurVipLevel").GetComponent<UILabel>(); this.ToBuy = transform.transform.Find("GoBtn"); this.Buyed = transform.transform.Find("Buy"); UIEventListener expr_105 = UIEventListener.Get(this.ToBuy.gameObject); expr_105.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_105.onClick, new UIEventListener.VoidDelegate(this.OnBuyVipWeekReward)); this.rewardScrollView = base.transform.Find("rewardPanel").GetComponent<UIScrollView>(); this.rewardTable = this.rewardScrollView.transform.Find("rewardContents").GetComponent<UITable>(); for (int i = 0; i <= 15; i++) { this.VIPLevel[i] = this.rewardTable.transform.Find(string.Format("{0:D2}", i)).GetComponent<UISprite>(); UIEventListener expr_1A7 = UIEventListener.Get(this.VIPLevel[i].gameObject); expr_1A7.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1A7.onClick, new UIEventListener.VoidDelegate(this.OnVIPLevelClicked)); } this.mTabBtnScrollBar = base.transform.Find("scrollBar").GetComponent<UIScrollBar>(); EventDelegate.Add(this.mTabBtnScrollBar.onChange, new EventDelegate.Callback(this.OnScrollBarValueChange)); this.leftBtn = base.transform.Find("LeftBtn").gameObject; this.rightBtn = base.transform.Find("RightBtn").gameObject; UIEventListener expr_24D = UIEventListener.Get(this.leftBtn); expr_24D.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_24D.onClick, new UIEventListener.VoidDelegate(this.OnLeftBtnClicked)); UIEventListener expr_279 = UIEventListener.Get(this.rightBtn); expr_279.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_279.onClick, new UIEventListener.VoidDelegate(this.OnRightBtnClicked)); this.RefreshCurLevelToggle(); this.RefreshCurLevelInfo(); }
/// <summary> /// Helper function used in UpdateScrollbars(float) function above. /// </summary> void UpdateScrollbars (UIScrollBar sb, float contentMin, float contentMax, float contentSize, float viewSize, bool inverted) { if (viewSize < contentSize) { contentMin = Mathf.Clamp01(contentMin / contentSize); contentMax = Mathf.Clamp01(contentMax / contentSize); } else { contentMin = Mathf.Clamp01(-contentMin / contentSize); contentMax = Mathf.Clamp01(-contentMax / contentSize); } mIgnoreCallbacks = true; { float contentPadding = contentMin + contentMax; sb.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) : ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f); if (sb != null) sb.barSize = 1f - contentPadding; } mIgnoreCallbacks = false; }
/// <summary> /// Triggered by the vertical scroll bar when it changes. /// </summary> void OnVerticalBar(UIScrollBar sb) { if (!mIgnoreCallbacks) { float y = (verticalScrollBar != null) ? verticalScrollBar.value : 0f; SetDragAmount(0, y, false); } }
protected override void AwakeImpl() { base.AwakeImpl(); m_ViewSpriteTr = transform.FindChild("ListBaseSprite"); m_ViewScale = m_ViewSpriteTr.localScale; m_TopLeft = transform.FindChild("ListBaseSprite/TopLeft"); m_BottomRight = transform.FindChild("ListBaseSprite/BottomRight"); //m_DragCamera = transform.FindChild("ListBaseSprite").GetComponent<UIDragCamera>(); NvGameUIManager mgr = Singlton.getInstance("NvGameUIManager") as NvGameUIManager; m_UICamera = mgr.GameUICamera; m_ListPrefab = Resources.Load("UI Prefabs/Prefabs/Controls/UIListView") as GameObject; m_ListView = GameObject.Instantiate( m_ListPrefab ) as GameObject; //rename list view m_ListView.name = listName; Transform listviewCamera = m_ListView.transform.FindChild("UIListViewCamera"); //Transform listviewCamera = m_ListView.transform.FindChild("UIListViewCamera" ); //m_ListViewCamera = listviewCamera.GetComponent<UIDraggableCamera>(); //rename list view draggable camera //m_ListViewCamera.name = listName + "Camera"; //set draggable camera to drag camera //m_DragCamera.draggableCamera = m_ListViewCamera; m_ListViewViewport = listviewCamera.GetComponent<UIViewport>(); //set viewport camera m_ListViewViewport.sourceCamera = m_UICamera; m_ListViewLink = m_ListView.transform.FindChild("Link"); m_ListViewLink.localScale = Utility.GetScreenRatio(); Transform listOffset = m_ListView.transform.FindChild("Link/Anchor/ListOffset"); listOffset.transform.localPosition = new Vector3 ( dragCameraDistance, dragCameraDistance, listOffset.transform.localPosition.z ); m_ListViewTable = listOffset.GetComponent<UITable>(); m_listViewAnchor = m_ListView.transform.FindChild("Link/Anchor").GetComponent<UIAnchor>(); //m_DragPanel = m_ListView.transform.FindChild("Link/Anchor/ListOffset").GetComponent<UIDraggablePanel>(); //set ui layer camera to list view anchor m_listViewAnchor.uiCamera = m_UICamera; //set slider bar if ( horizontalScrollBar != null ) { m_horizontalScrollBar = horizontalScrollBar.GetComponent<UIScrollBar>(); //m_DragPanel.scale = new Vector3( 1.0f, 0.0f, 0.0f ); //m_DragPanel.horizontalScrollBar = m_horizontalScrollBar; } if ( verticalScrollBar != null ) { m_verticalScrollBar = verticalScrollBar.GetComponent<UIScrollBar>(); //m_DragPanel.scale = new Vector3( 0.0f, 1.0f, 0.0f ); //m_DragPanel.verticalScrollBar = m_verticalScrollBar; } }
// Use this for initialization void Start () { load = GameObject.Find("Load").GetComponent<UIScrollBar>(); label = GameObject.Find ("percent").GetComponent<UILabel> (); StartCoroutine (play()); }
void Awake() { mScrollBar = GetComponent <UIScrollBar>(); }
public static void registEvent(GameObject father, string name, Action function) { UISlider slider = getByName <UISlider>(father, name); if (slider != null) { MonoDelegate d = slider.gameObject.GetComponent <MonoDelegate>(); if (d == null) { d = slider.gameObject.AddComponent <MonoDelegate>(); } d.actionInMono = function; slider.onChange.Add(new EventDelegate(d, "function")); return; } UIPopupList list = getByName <UIPopupList>(father, name); if (list != null) { MonoDelegate d = list.gameObject.GetComponent <MonoDelegate>(); if (d == null) { d = list.gameObject.AddComponent <MonoDelegate>(); } d.actionInMono = function; list.onChange.Add(new EventDelegate(d, "function")); return; } UIToggle tog = getByName <UIToggle>(father, name); if (tog != null) { MonoDelegate d = tog.gameObject.GetComponent <MonoDelegate>(); if (d == null) { d = tog.gameObject.AddComponent <MonoDelegate>(); } d.actionInMono = function; tog.onChange.Clear(); tog.onChange.Add(new EventDelegate(d, "function")); return; } UIInput input = getByName <UIInput>(father, name); if (input != null) { MonoDelegate d = input.gameObject.GetComponent <MonoDelegate>(); if (d == null) { d = input.gameObject.AddComponent <MonoDelegate>(); } d.actionInMono = function; input.onSubmit.Clear(); input.onSubmit.Add(new EventDelegate(d, "function")); return; } UIScrollBar bar = getByName <UIScrollBar>(father, name); if (bar != null) { MonoDelegate d = bar.gameObject.GetComponent <MonoDelegate>(); if (d == null) { d = bar.gameObject.AddComponent <MonoDelegate>(); } d.actionInMono = function; bar.onChange.Clear(); bar.onChange.Add(new EventDelegate(d, "function")); return; } UIButton btn = getByName <UIButton>(father, name); if (btn != null) { MonoDelegate d = btn.gameObject.GetComponent <MonoDelegate>(); if (d == null) { d = btn.gameObject.AddComponent <MonoDelegate>(); } d.actionInMono = function; btn.onClick.Clear(); btn.onClick.Add(new EventDelegate(d, "function")); return; } }
protected override void OnLoad() { base.OnLoad(); for (int i = 0; i < (int)EquipSlot.EquipSlot_MAX; ++i) { mEquipUI[i] = new CommonItemUI(this.FindChild("RolePanel/Equip" + (i + 1).ToString())); } for (int i = 0; i < msMaxWingNum; ++i) { mWingObject[i] = this.FindChild("ProperyPanel/AllDisScroll/Panel/Wings/WingScroll/Wing" + (i + 1).ToString()); mWingIcon[i] = this.FindComponent <UISprite>("ProperyPanel/AllDisScroll/Panel/Wings/WingScroll/Wing" + (i + 1).ToString() + "/icon"); mWingLevel[i] = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/Wings/WingScroll/Wing" + (i + 1).ToString() + "/level"); } mRoleName = this.FindComponent <UILabel>("RolePanel/Name"); mName = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/Name"); mZhanli1 = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/Zhanli"); mZhanli2 = this.FindComponent <UILabel>("RolePanel/Zhanli/Label"); mExp = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/Exp"); mHp = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/hp"); mMp = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/mp"); mDefence = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/fanghu"); mDamage = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/shanghai"); mCritLv = this.FindComponent <UILabel>("ProperyPanel/AllDisScroll/Panel/baoji"); mMainCrops = this.FindChild("ProperyPanel/AllDisScroll/Panel/Crops/CropsItem1"); mSubCrops = this.FindChild("ProperyPanel/AllDisScroll/Panel/Crops/CropsItem2"); mItemPrefab = this.FindChild("Items/ItemUI"); mLockItem = this.FindChild("ItemPanel/ItemsScrollView/LockUI"); mScrollView = this.FindComponent <UIScrollView>("ItemPanel/ItemsScrollView"); mScrollBar = this.FindComponent <UIScrollBar>("ItemPanel/ScrollBar"); mScrollBar.gameObject.SetActive(true); mScrollBar.foregroundWidget.gameObject.SetActive(false); mWeaponIcon = this.FindComponent <UIButton>("RolePanel/bg/weapon"); mToggleAll = this.FindComponent <UIToggle>("ItemPanel/BntAll"); mToggleItem = this.FindComponent <UIToggle>("ItemPanel/BntItem"); mToggleGem = this.FindComponent <UIToggle>("ItemPanel/BntGem"); mPreveiwSprite = this.FindComponent <UISprite>("RolePanel/RoleModel"); mTitleRedPoint = this.FindChild("RolePanel/bntChenghao/hongdian"); mTitleBtn = this.FindComponent <UIButton>("RolePanel/bntChenghao"); mOpenBtn = this.FindComponent <UIButton>("RolePanel/bntBag"); mBtnWeapon = this.FindComponent <UIButton>("RolePanel/bg/weapon"); mBagPanel = this.FindChild("ItemPanel"); mInfoPanel = this.FindChild("ProperyPanel"); mWeaponSterLv = this.FindComponent <UILabel>("RolePanel/weaponlv"); mWeaponPromoteLv = this.FindComponent <UILabel>("RolePanel/jieji/Label"); mWeaponGradeBg = this.FindComponent <UISprite>("RolePanel/zhishi"); mWeaponGradePic = this.FindComponent <UISprite>("RolePanel/zhishi/lv"); mWeaponLvPic = this.FindComponent <UISprite>("RolePanel/xingji"); mOpenLabel = this.FindComponent <UILabel>("RolePanel/bntBag/Label"); mOpenLabel.text = "角色信息"; NGUITools.SetActive(mBagPanel.gameObject, true); NGUITools.SetActive(mInfoPanel.gameObject, false); mItemsGrid = this.FindComponent <UIGrid>("ItemPanel/ItemsScrollView/UIGrid"); EventDelegate.Add(mToggleAll.onChange, onToggleChanged); EventDelegate.Add(mToggleItem.onChange, onToggleChanged); EventDelegate.Add(mToggleGem.onChange, onToggleChanged); EventDelegate.Add(mTitleBtn.onClick, onTitleBtnClick); EventDelegate.Add(mOpenBtn.onClick, onOpenButtonClick); EventDelegate.Add(mBtnWeapon.onClick, OnBtnWeaponClick); UIButton lockButton = mLockItem.GetComponent <UIButton>(); EventDelegate.Add(lockButton.onClick, onLockButtonClick); mPreveiwSprite.width = mPreveiwSprite.height; mPreview.SetTargetSprite(mPreveiwSprite); mPreview.RotationY = 180; }
public GOScrollBar(GameObject obj) : base(obj) { Bar = obj.GetExactComponent <UIScrollBar>(); }
private void Update() { if (!m_isInstall || m_child == null) { // 子供が作られ終わったら if (transform.childCount > 0) { UIGrid grid = transform.GetComponent <UIGrid>(); if (grid) { // 子供(ボタン)を取得 List <Transform> items = grid.GetChildList(); float topY = float.MinValue; Transform topButton = null; Transform selectedButton = null; // フレームに拡縮アニメーション用のコンポーネントを付けていく foreach (var item in items) { Transform frame = item.Find("Frame"); if (frame) { // コンポーネントを付ける frame.gameObject.AddComponent <SelectedAnime>(); // フレームがアクティブなら選択されたボタン if (frame.gameObject.activeSelf) { selectedButton = frame.parent; } // 一番上の列にあるボタンを探しておく // 上のほうがローカルYが大きい if (frame.parent.localPosition.y > topY) { topY = frame.parent.localPosition.y; topButton = frame.parent; } m_child = item.gameObject; } } // 選択されたボタンをまでスクロールするかどうか if (Define.AutoScrollEnable) { if (selectedButton && topButton) { UICenterOnChild coc = GetComponent <UICenterOnChild>(); UIScrollView sv = transform.parent.GetComponent <UIScrollView>(); UIScrollBar sb = transform.parent.parent.GetComponentInChildren <UIScrollBar>(); if (coc && sv && sb) { // スクロールバーが有効なら if (sv.shouldMoveVertically) { // ローカル位置にボタンの座標が入っている float buttonPos = Math.Abs(selectedButton.localPosition.y - topButton.localPosition.y); // 一番下まで下げた時のビューの位置 float bottomPos = sv.bounds.size.y - sv.panel.height + 20; // スクロールバーの位置 float scrollVal = 0.0f; // バーの位置を算出する scrollVal = buttonPos / bottomPos; scrollVal = Math.Max(Math.Min(scrollVal, 1.0f), 0.0f); sb.value = scrollVal; sb.ForceUpdate(); } } } } m_isInstall = true; } } } }
public UIFormatScrollPanle(int sort, UIPanel panel, UIScrollBar ScrBar, UIDragScrollView bgUIDragPanelContents) { this.bgUIDragPanelContents = bgUIDragPanelContents; setData(sort, panel, ScrBar); }
private void CreateObjects() { this.mLevelSW = base.transform.Find("rewardPanel").GetComponent<UIScrollView>(); this.mLevelRecordTable = this.mLevelSW.transform.Find("rewardContents").GetComponent<UITable>(); this.mLevelRecordTable.columns = 1; this.mLevelRecordTable.direction = UITable.Direction.Down; this.mLevelRecordTable.sorting = UITable.Sorting.None; this.mLevelRecordTable.hideInactive = true; this.mLevelRecordTable.keepWithinPanel = true; this.mLevelRecordTable.padding = new Vector2(0f, 2f); this.mLevelScrollBar = base.transform.Find("scrollBar").GetComponent<UIScrollBar>(); }
/// <summary> /// Scroll bar template. /// </summary> void CreateScrollBar(GameObject go) { if (NGUISettings.atlas != null) { NGUIEditorTools.DrawSpriteField("Background", "Sprite used for the background", NGUISettings.atlas, mScrollBG, OnScrollBG, GUILayout.Width(120f)); NGUIEditorTools.DrawSpriteField("Foreground", "Sprite used for the foreground (thumb)", NGUISettings.atlas, mScrollFG, OnScrollFG, GUILayout.Width(120f)); GUILayout.BeginHorizontal(); UIScrollBar.FillDirection dir = (UIScrollBar.FillDirection)EditorGUILayout.EnumPopup("Direction", mFillDir, GUILayout.Width(200f)); GUILayout.Space(20f); GUILayout.Label("Add colliders?", GUILayout.Width(90f)); bool draggable = EditorGUILayout.Toggle(mScrollCL); GUILayout.EndHorizontal(); if (mScrollCL != draggable || mFillDir != dir) { mScrollCL = draggable; mFillDir = dir; Save(); } } if (ShouldCreate(go, NGUISettings.atlas != null)) { int depth = NGUITools.CalculateNextDepth(go); go = NGUITools.AddChild(go); go.name = "Scroll Bar"; UISprite bg = NGUITools.AddWidget <UISprite>(go); bg.type = UISprite.Type.Sliced; bg.name = "Background"; bg.depth = depth; bg.atlas = NGUISettings.atlas; bg.spriteName = mScrollBG; Vector4 border = bg.border; bg.width = Mathf.RoundToInt(400f + border.x + border.z); bg.height = Mathf.RoundToInt(14f + border.y + border.w); bg.MakePixelPerfect(); UISprite fg = NGUITools.AddWidget <UISprite>(go); fg.type = UISprite.Type.Sliced; fg.name = "Foreground"; fg.atlas = NGUISettings.atlas; fg.spriteName = mScrollFG; UIScrollBar sb = go.AddComponent <UIScrollBar>(); sb.foregroundWidget = fg; sb.backgroundWidget = bg; sb.fillDirection = mFillDir; sb.barSize = 0.3f; sb.value = 0.3f; sb.ForceUpdate(); if (mScrollCL) { NGUITools.AddWidgetCollider(bg.gameObject); NGUITools.AddWidgetCollider(fg.gameObject); } Selection.activeGameObject = go; } }
private void OnDestroy() { UIScrollBar scrollbar = m_scrollbar; scrollbar.onChange = (UIScrollBar.OnScrollBarChange)Delegate.Remove(scrollbar.onChange, new UIScrollBar.OnScrollBarChange(OnScrollbarChanged)); }
public UIFormatScrollPanle(int sort, UIPanel panel, UIScrollBar ScrBar) { setData(sort, panel, ScrBar); }
/// <summary> /// Scroll bar template. /// </summary> void CreateScrollBar(GameObject go) { if (UISettings.atlas != null) { GUILayout.BeginHorizontal(); string bg = UISpriteInspector.SpriteField(UISettings.atlas, "Background", mScrollBG, GUILayout.Width(200f)); GUILayout.Space(20f); GUILayout.Label("Sprite for the background"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); string fg = UISpriteInspector.SpriteField(UISettings.atlas, "Foreground", mScrollFG, GUILayout.Width(200f)); GUILayout.Space(20f); GUILayout.Label("Sprite for the foreground (thumb)"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); UIScrollBar.Direction dir = (UIScrollBar.Direction)EditorGUILayout.EnumPopup("Direction", mScrollDir, GUILayout.Width(200f)); GUILayout.Space(20f); GUILayout.Label("Add colliders?", GUILayout.Width(80f)); bool draggable = EditorGUILayout.Toggle(mScrollCL); GUILayout.EndHorizontal(); if (mScrollBG != bg || mScrollFG != fg || mScrollCL != draggable || mScrollDir != dir) { mScrollBG = bg; mScrollFG = fg; mScrollCL = draggable; mScrollDir = dir; Save(); } } if (ShouldCreate(go, UISettings.atlas != null)) { int depth = NGUITools.CalculateNextDepth(go); go = NGUITools.AddChild(go); go.name = "Scroll Bar"; UISlicedSprite bg = NGUITools.AddWidget <UISlicedSprite>(go); bg.name = "Background"; bg.depth = depth; bg.atlas = UISettings.atlas; bg.spriteName = mScrollBG; bg.transform.localScale = new Vector3(400f + bg.border.x + bg.border.z, 14f + bg.border.y + bg.border.w, 1f); bg.MakePixelPerfect(); UISlicedSprite fg = NGUITools.AddWidget <UISlicedSprite>(go); fg.name = "Foreground"; fg.atlas = UISettings.atlas; fg.spriteName = mScrollFG; UIScrollBar sb = go.AddComponent <UIScrollBar>(); sb.background = bg; sb.foreground = fg; sb.direction = mScrollDir; sb.barSize = 0.3f; sb.scrollValue = 0.3f; sb.ForceUpdate(); if (mScrollCL) { NGUITools.AddWidgetCollider(bg.gameObject); NGUITools.AddWidgetCollider(fg.gameObject); } Selection.activeGameObject = go; } }
public void SetCameraScrollBar(UIScrollBar scrollBar) { cameraScrollBar = scrollBar; }
/// <summary> /// Triggered by the horizontal scroll bar when it changes. /// </summary> void OnHorizontalBar(UIScrollBar sb) { if (!mIgnoreCallbacks && horizontalScrollBar != null) { float x = horizontalScrollBar.value; UpdateView(x > mLastHoriValue); mLastHoriValue = x; SetDragAmount(x, 0, false); } }
/// <summary> /// Register the event listeners. /// </summary> void Start () { if (background != null && background.collider != null) { UIEventListener listener = UIEventListener.Get(background.gameObject); listener.onPress += OnPressBackground; listener.onDrag += OnDragBackground; } if (foreground != null && foreground.collider != null) { UIEventListener listener = UIEventListener.Get(foreground.gameObject); listener.onPress += OnPressForeground; listener.onDrag += OnDragForeground; } if (onChange != null) { current = this; EventDelegate.Execute(onChange); current = null; } ForceUpdate(); }
private void CreateObjects() { GameUIManager.mInstance.GetTopGoods().Show("activityLb"); this.mWinBg = base.transform.Find("WinBg"); UILabel uILabel = GameUITools.FindUILabel("Date", this.mWinBg.gameObject); DateTime dateTime = Tools.ServerDateTime(Globals.Instance.Player.GetTimeStamp()); uILabel.text = Singleton<StringManager>.Instance.GetString("RewardDate", new object[] { dateTime.Year, string.Format("{0:D2}", dateTime.Month), string.Format("{0:D2}", dateTime.Day) }); this.mTopBtn = base.RegisterClickEvent("TopBtn", new UIEventListener.VoidDelegate(this.OnTopBtnClick), this.mWinBg.gameObject); this.mTopBtn.gameObject.SetActive(false); this.mBottomBtn = base.RegisterClickEvent("BottomBtn", new UIEventListener.VoidDelegate(this.OnBottomBtnClick), this.mWinBg.gameObject); this.mBottomBtn.gameObject.SetActive(false); Transform transform = this.mWinBg.Find("leftTabs"); this.mTabBtnsTable = transform.Find("tabBtnsPanel/tabBtns").GetComponent<UIGrid>(); this.mTabBtnScrollBar = transform.Find("scrollBar").GetComponent<UIScrollBar>(); EventDelegate.Add(this.mTabBtnScrollBar.onChange, new EventDelegate.Callback(this.OnScrollBarValueChange)); this.mTabLevelReward = this.mTabBtnsTable.transform.Find("tabLevel").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabLevelReward.InitWithBaseScene(false, "a00", "ar"); GUIRewardCheckBtn expr_1BE = this.mTabLevelReward; expr_1BE.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_1BE.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnLevelCheckChanged)); this.mTabEnergy = this.mTabBtnsTable.transform.Find("tabKeys").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabEnergy.InitWithBaseScene(false, "a01", "Keys"); GUIRewardCheckBtn expr_220 = this.mTabEnergy; expr_220.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_220.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnKeysRewardChanged)); this.mTabSoulReliquary = this.mTabBtnsTable.transform.Find("tabSoulReliquary").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabSoulReliquary.InitWithBaseScene(false, "b00", "SoulIcon"); GUIRewardCheckBtn expr_282 = this.mTabSoulReliquary; expr_282.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_282.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnSoulReliquaryChanged)); this.mTabShare = this.mTabBtnsTable.transform.Find("tabShare").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabShare.InitWithBaseScene(false, "z10", "Share"); GUIRewardCheckBtn expr_2E4 = this.mTabShare; expr_2E4.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_2E4.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnShareCheckChanged)); this.mTabDay7Login = this.mTabBtnsTable.transform.Find("tabDay7").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabDay7Login.InitWithBaseScene(false, "b00", "7Days"); GUIRewardCheckBtn expr_346 = this.mTabDay7Login; expr_346.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_346.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnDay7CheckChanged)); this.mTabCards = this.mTabBtnsTable.transform.Find("tabCards").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabCards.InitWithBaseScene(false, "t00", "Card"); GUIRewardCheckBtn expr_3A8 = this.mTabCards; expr_3A8.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_3A8.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnCardsRewardChanged)); this.mTabVip = this.mTabBtnsTable.transform.Find("tabVIP").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabVip.InitWithBaseScene(false, "a04", "VIP"); GUIRewardCheckBtn expr_40A = this.mTabVip; expr_40A.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_40A.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnVipRewardChanged)); this.mTabVip.IsShowMark = false; this.mTabWeekVip = this.mTabBtnsTable.transform.Find("tabWeekVIP").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mTabWeekVip.InitWithBaseScene(false, "a03", "VIP"); GUIRewardCheckBtn expr_478 = this.mTabWeekVip; expr_478.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_478.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnVipWeekRewardChanged)); this.mTabWeekVip.IsShowMark = false; this.mFundReward = this.mTabBtnsTable.transform.Find("tabFund").gameObject.AddComponent<GUIRewardCheckBtn>(); this.mFundReward.InitWithBaseScene(false, "a02", "fund"); GUIRewardCheckBtn expr_4E6 = this.mFundReward; expr_4E6.CheckChangeCallbackEvent = (GUIRewardCheckBtn.CheckChangeCallback)Delegate.Combine(expr_4E6.CheckChangeCallbackEvent, new GUIRewardCheckBtn.CheckChangeCallback(this.OnFundRewardChanged)); this.mTabLevelReward.gameObject.SetActive(false); this.mTabShare.gameObject.SetActive(false); this.mTabDay7Login.gameObject.SetActive(false); this.mTabEnergy.gameObject.SetActive(false); this.mTabCards.gameObject.SetActive(false); this.mTabVip.gameObject.SetActive(false); this.mTabWeekVip.gameObject.SetActive(false); this.mTabSoulReliquary.gameObject.SetActive(false); this.mFundReward.gameObject.SetActive(false); base.StartCoroutine(this.InitScene()); }
public WXUIScrollBarScript(UIScrollBar sb, GameObject go, WXEntity entity) { this.uiScrollBar = sb; this.go = go; this.entity = entity; }
private void CreateObjects() { this.mBg = base.transform.Find("Bg").gameObject; this.mScrollView = this.mBg.transform.Find("infoPanel").GetComponent<UIScrollView>(); this.mInfoTable = this.mScrollView.transform.Find("infoContents").gameObject.AddComponent<MailDetailContentTable>(); this.mInfoTable.columns = 1; this.mInfoTable.direction = UITable.Direction.Down; this.mInfoTable.sorting = UITable.Sorting.Custom; this.mInfoTable.hideInactive = true; this.mInfoTable.keepWithinPanel = true; this.mInfoTable.padding = new Vector2(0f, 0f); this.mScrollBar = this.mBg.transform.Find("infoScrollBar").GetComponent<UIScrollBar>(); this.mMailTitle = this.mInfoTable.transform.Find("Title").gameObject.AddComponent<MailTitle>(); this.mMainDetailInfo = this.mInfoTable.transform.Find("infoLabel").gameObject.AddComponent<MailContents>(); this.mMailSender = this.mInfoTable.transform.Find("sender").gameObject.AddComponent<MailSender>(); this.mSpriteLine = this.mInfoTable.transform.Find("line").gameObject.AddComponent<SpriteLine>(); GameObject gameObject = base.transform.Find("MailContentBG").gameObject; UIEventListener expr_18B = UIEventListener.Get(gameObject.gameObject); expr_18B.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_18B.onClick, new UIEventListener.VoidDelegate(this.OnBackGroundClick)); GameObject gameObject2 = this.mBg.transform.Find("takeBtn").gameObject; UIEventListener expr_1CD = UIEventListener.Get(gameObject2); expr_1CD.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1CD.onClick, new UIEventListener.VoidDelegate(this.OnTakeAffixClick)); this.mBtnTxt = gameObject2.transform.Find("Label").GetComponent<UILabel>(); }
private bool initialize() { try{ maid = GameMain.Instance.CharacterMgr.GetMaid(0); if (maid == null) return false; UIAtlas uiAtlasSceneEdit = FindAtlas("AtlasSceneEdit"); UIAtlas uiAtlasDialog = FindAtlas("SystemDialog"); GameObject goUIRoot = GameObject.Find("UI Root"); GameObject cameraObject = GameObject.Find("/UI Root/Camera"); Camera cameraComponent = cameraObject.GetComponent<Camera>(); uiCamara = cameraObject.GetComponent<UICamera>(); #region createSlider // スライダー作成 GameObject goTestSliderUnit = new GameObject("TestSliderUnit"); SetChild(goUIRoot, goTestSliderUnit); { UISprite uiTestSliderUnitFrame = goTestSliderUnit.AddComponent<UISprite>(); uiTestSliderUnitFrame.atlas = uiAtlasSceneEdit; uiTestSliderUnitFrame.spriteName = "cm3d2_edit_slidertitleframe"; uiTestSliderUnitFrame.type = UIBasicSprite.Type.Sliced; uiTestSliderUnitFrame.SetDimensions(500, 50); // スライダー作成 UISlider uiTestSlider = NGUITools.AddChild<UISlider>(goTestSliderUnit); UISprite uiTestSliderRail = uiTestSlider.gameObject.AddComponent<UISprite>(); uiTestSliderRail.name = "Slider"; uiTestSliderRail.atlas = uiAtlasSceneEdit; uiTestSliderRail.spriteName = "cm3d2_edit_slideberrail"; uiTestSliderRail.type = UIBasicSprite.Type.Sliced; uiTestSliderRail.SetDimensions(250, 5); UIWidget uiTestSliderBar = NGUITools.AddChild<UIWidget>(uiTestSlider.gameObject); uiTestSliderBar.name = "DummyBar"; uiTestSliderBar.width = uiTestSliderRail.width; UISprite uiTestSliderThumb = NGUITools.AddChild<UISprite>(uiTestSlider.gameObject); uiTestSliderThumb.name = "Thumb"; uiTestSliderThumb.depth = uiTestSliderRail.depth + 1; uiTestSliderThumb.atlas = uiAtlasSceneEdit; uiTestSliderThumb.spriteName = "cm3d2_edit_slidercursor"; uiTestSliderThumb.type = UIBasicSprite.Type.Sliced; uiTestSliderThumb.SetDimensions(25, 25); uiTestSliderThumb.gameObject.AddComponent<BoxCollider>(); uiTestSlider.backgroundWidget = uiTestSliderRail; uiTestSlider.foregroundWidget = uiTestSliderBar; uiTestSlider.thumb = uiTestSliderThumb.gameObject.transform; uiTestSlider.value = 0.5f; uiTestSlider.gameObject.AddComponent<BoxCollider>(); uiTestSlider.transform.localPosition = new Vector3(100f, 0f, 0f); NGUITools.UpdateWidgetCollider(uiTestSlider.gameObject); NGUITools.UpdateWidgetCollider(uiTestSliderThumb.gameObject); // スライダーラベル作成 UILabel uiTestSliderLabel = NGUITools.AddChild<UILabel>(goTestSliderUnit); uiTestSliderLabel.name = "Label"; uiTestSliderLabel.trueTypeFont = font; uiTestSliderLabel.fontSize = 20; uiTestSliderLabel.text = "テストスライダー"; uiTestSliderLabel.width = 110; uiTestSliderLabel.overflowMethod = UILabel.Overflow.ShrinkContent; uiTestSliderLabel.transform.localPosition = new Vector3(-190f, 0f, 0f); // 値ラベル・インプット作成 UISprite uiTestSliderValueBase = NGUITools.AddChild<UISprite>(goTestSliderUnit); uiTestSliderValueBase.name = "ValueBase"; uiTestSliderValueBase.atlas = uiAtlasSceneEdit; uiTestSliderValueBase.spriteName = "cm3d2_edit_slidernumberframe"; uiTestSliderValueBase.type = UIBasicSprite.Type.Sliced; uiTestSliderValueBase.SetDimensions(80, 35); uiTestSliderValueBase.transform.localPosition = new Vector3(-90f, 0f, 0f); UILabel uiTestSliderValueLabel = NGUITools.AddChild<UILabel>(uiTestSliderValueBase.gameObject); uiTestSliderValueLabel.name = "Value"; uiTestSliderValueLabel.depth = uiTestSliderValueBase.depth + 1; uiTestSliderValueLabel.width = uiTestSliderValueBase.width; uiTestSliderValueLabel.trueTypeFont = font; uiTestSliderValueLabel.fontSize = 20; uiTestSliderValueLabel.text = "0.00"; uiTestSliderValueLabel.color = Color.black; UIInput uiTestSliderValueInput = uiTestSliderValueLabel.gameObject.AddComponent<UIInput>(); uiTestSliderValueInput.label = uiTestSliderValueLabel; uiTestSliderValueInput.onReturnKey = UIInput.OnReturnKey.Submit; uiTestSliderValueInput.validation = UIInput.Validation.Float; uiTestSliderValueInput.activeTextColor = Color.black; uiTestSliderValueInput.caretColor = new Color(0.1f, 0.1f, 0.3f, 1f); uiTestSliderValueInput.selectionColor = new Color(0.3f, 0.3f, 0.6f, 0.8f); //EventDelegate.Add(uiTestSliderValueInput.onSubmit, new EventDelegate.Callback(this.OnSubmitSliderValueInput)); uiTestSliderValueInput.gameObject.AddComponent<BoxCollider>(); NGUITools.UpdateWidgetCollider(uiTestSliderValueInput.gameObject); } goTestSliderUnit.SetActive(false); #endregion // ボタンはgoProfileTabをコピー GameObject goProfileTabCopy = UnityEngine.Object.Instantiate( FindChild(goUIRoot.transform.Find("ProfilePanel").Find("Comment").gameObject, "ProfileTab") ) as GameObject; EventDelegate.Remove(goProfileTabCopy.GetComponent<UIButton>().onClick, new EventDelegate.Callback(ProfileMgr.Instance.ChangeCommentTab)); goProfileTabCopy.SetActive(false); #region createPanel // ModsSliderPanel作成 Vector3 originAMSPanel = new Vector3(UIRootWidth / 2f - 15f - ScrollViewWidth / 2f - 50f, 40f, 0f); int systemUnitHeight = 30; // 親Panel uiAMSPanel = NGUITools.AddChild<UIPanel>(goUIRoot); uiAMSPanel.name = "ModsSliderPanel"; uiAMSPanel.transform.localPosition = originAMSPanel; goAMSPanel = uiAMSPanel.gameObject; // 背景 UISprite uiBGSprite = NGUITools.AddChild<UISprite>(goAMSPanel); uiBGSprite.name = "BG"; uiBGSprite.atlas = uiAtlasSceneEdit; uiBGSprite.spriteName = "cm3d2_edit_window_l"; uiBGSprite.type = UIBasicSprite.Type.Sliced; uiBGSprite.SetDimensions(ScrollViewWidth, ScrollViewHeight); // ScrollViewPanel uiScrollPanel = NGUITools.AddChild<UIPanel>(goAMSPanel); uiScrollPanel.name = "ScrollView"; uiScrollPanel.sortingOrder = uiAMSPanel.sortingOrder + 1; uiScrollPanel.clipping = UIDrawCall.Clipping.SoftClip; uiScrollPanel.SetRect(0f, 0f, uiBGSprite.width, uiBGSprite.height - 110 - systemUnitHeight); uiScrollPanel.transform.localPosition = new Vector3(-25f, - systemUnitHeight, 0f); goScrollView = uiScrollPanel.gameObject; uiScrollView = goScrollView.AddComponent<UIScrollView>(); uiScrollView.contentPivot = UIWidget.Pivot.Center; uiScrollView.movement = UIScrollView.Movement.Vertical; uiScrollView.scrollWheelFactor = 1.5f; uiBGSprite.gameObject.AddComponent<UIDragScrollView>().scrollView = uiScrollView; uiBGSprite.gameObject.AddComponent<BoxCollider>(); NGUITools.UpdateWidgetCollider(uiBGSprite.gameObject); // ScrollBar uiScrollBar = NGUITools.AddChild<UIScrollBar>(goAMSPanel); uiScrollBar.value = 0f; uiScrollBar.gameObject.AddComponent<BoxCollider>(); uiScrollBar.transform.localPosition = new Vector3(uiBGSprite.width / 2f-10, 0f, 0f); uiScrollBar.transform.localRotation *= Quaternion.Euler(0f, 0f, -90f); UIWidget uiScrollBarFore = NGUITools.AddChild<UIWidget>(uiScrollBar.gameObject); uiScrollBarFore.name = "DummyFore"; uiScrollBarFore.height = 15; uiScrollBarFore.width = uiBGSprite.height; UISprite uiScrollBarThumb = NGUITools.AddChild<UISprite>(uiScrollBar.gameObject); uiScrollBarThumb.name = "Thumb"; uiScrollBarThumb.depth = uiBGSprite.depth + 1; uiScrollBarThumb.atlas = uiAtlasSceneEdit; uiScrollBarThumb.spriteName = "cm3d2_edit_slidercursor"; uiScrollBarThumb.type = UIBasicSprite.Type.Sliced; uiScrollBarThumb.SetDimensions(15, 15); uiScrollBarThumb.gameObject.AddComponent<BoxCollider>(); uiScrollBar.foregroundWidget = uiScrollBarFore; uiScrollBar.thumb = uiScrollBarThumb.transform; NGUITools.UpdateWidgetCollider(uiScrollBarFore.gameObject); NGUITools.UpdateWidgetCollider(uiScrollBarThumb.gameObject); uiScrollView.verticalScrollBar = uiScrollBar; // ScrollView内のTable uiTable = NGUITools.AddChild<UITable>(goScrollView); uiTable.pivot = UIWidget.Pivot.Center; uiTable.columns = 1; uiTable.padding = new Vector2(25f, 10f); uiTable.hideInactive = true; uiTable.keepWithinPanel = true; uiTable.sorting = UITable.Sorting.Custom; uiTable.onCustomSort = (Comparison<Transform>)this.sortGridByXMLOrder; //uiTable.onReposition = this.OnRepositionTable; goScrollViewTable = uiTable.gameObject; //uiScrollView.centerOnChild = goScrollViewTable.AddComponent<UICenterOnChild>(); // ドラッグ用タブ(タイトル部分) UISprite uiSpriteTitleTab = NGUITools.AddChild<UISprite>(goAMSPanel); uiSpriteTitleTab.name = "TitleTab"; uiSpriteTitleTab.depth = uiBGSprite.depth - 1; uiSpriteTitleTab.atlas = uiAtlasDialog; uiSpriteTitleTab.spriteName = "cm3d2_dialog_frame"; uiSpriteTitleTab.type = UIBasicSprite.Type.Sliced; uiSpriteTitleTab.SetDimensions(300, 80); uiSpriteTitleTab.autoResizeBoxCollider = true; uiSpriteTitleTab.gameObject.AddComponent<UIDragObject>().target = goAMSPanel.transform; uiSpriteTitleTab.gameObject.AddComponent<BoxCollider>().isTrigger = true; NGUITools.UpdateWidgetCollider(uiSpriteTitleTab.gameObject); uiSpriteTitleTab.transform.localPosition = new Vector3(uiBGSprite.width / 2f + 5f, (uiBGSprite.height - uiSpriteTitleTab.width) / 2f, 0f); uiSpriteTitleTab.transform.localRotation *= Quaternion.Euler(0f, 0f, -90f); UILabel uiLabelTitleTab = uiSpriteTitleTab.gameObject.AddComponent<UILabel>(); uiLabelTitleTab.depth = uiSpriteTitleTab.depth + 1; uiLabelTitleTab.width = uiSpriteTitleTab.width; uiLabelTitleTab.color = Color.white; uiLabelTitleTab.trueTypeFont = font; uiLabelTitleTab.fontSize = 18; uiLabelTitleTab.text = "Mods Slider " + AddModsSlider.Version; int conWidth = (int)(uiBGSprite.width - uiTable.padding.x * 2); int baseTop = (int)(uiBGSprite.height / 2f - 50); GameObject goSystemUnit = NGUITools.AddChild(goAMSPanel); goSystemUnit.name = ("System:Undo"); // Undoボタン GameObject goUndoAll = SetCloneChild(goSystemUnit, goProfileTabCopy, "UndoAll"); goUndoAll.transform.localPosition = new Vector3(-conWidth * 0.25f - 6, baseTop - systemUnitHeight / 2f, 0f); goUndoAll.AddComponent<UIDragScrollView>().scrollView = uiScrollView; UISprite uiSpriteUndoAll = goUndoAll.GetComponent<UISprite>(); uiSpriteUndoAll.SetDimensions((int)(conWidth * 0.5f) - 2, systemUnitHeight); UILabel uiLabelUndoAll = FindChild(goUndoAll,"Name").GetComponent<UILabel>(); uiLabelUndoAll.width = uiSpriteUndoAll.width - 10; uiLabelUndoAll.fontSize = 22; uiLabelUndoAll.spacingX = 0; uiLabelUndoAll.supportEncoding = true; uiLabelUndoAll.text = "[111111]UndoAll"; UIButton uiButtonUndoAll = goUndoAll.GetComponent<UIButton>(); uiButtonUndoAll.defaultColor = new Color(1f, 1f, 1f, 0.8f); EventDelegate.Set(uiButtonUndoAll.onClick, new EventDelegate.Callback(this.OnClickUndoAll)); FindChild(goUndoAll,"SelectCursor").GetComponent<UISprite>().SetDimensions(16,16); FindChild(goUndoAll,"SelectCursor").SetActive(false); NGUITools.UpdateWidgetCollider(goUndoAll); goUndoAll.SetActive(true); // Resetボタン GameObject goResetAll = SetCloneChild(goSystemUnit, goUndoAll, "ResetAll"); goResetAll.transform.localPosition = new Vector3(conWidth * 0.25f - 4, baseTop - systemUnitHeight / 2f, 0f); UILabel uiLabelResetAll = FindChild(goResetAll,"Name").GetComponent<UILabel>(); uiLabelResetAll.text = "[111111]ResetAll"; UIButton uiButtonResetAll = goResetAll.GetComponent<UIButton>(); uiButtonResetAll.defaultColor = new Color(1f, 1f, 1f, 0.8f); EventDelegate.Set(uiButtonResetAll.onClick, new EventDelegate.Callback(this.OnClickResetAll)); NGUITools.UpdateWidgetCollider(goResetAll); goResetAll.SetActive(true); #endregion // 拡張セーブデータ読込 Debug.Log(LogLabel +"Loading ExternalSaveData..."); Debug.Log("----------------ExternalSaveData----------------"); getExSaveData(); Debug.Log("------------------------------------------------"); #region addTableContents // ModsParamの設定に従ってボタン・スライダー追加 for (int i = 0; i < mp.KeyCount; i++) { string key = mp.sKey[i]; if (!mp.bVisible[key]) continue; uiValueLable[key] = new Dictionary<string, UILabel>(); string modeDesc = mp.sDescription[key] + " (" + key + ")"; // ModUnit:modタグ単位のまとめオブジェクト ScrollViewGridの子 GameObject goModUnit = NGUITools.AddChild(goScrollViewTable); goModUnit.name = ("Unit:" + key); trModUnit[key] = goModUnit.transform; // プロフィールタブ複製・追加 GameObject goHeaderButton = SetCloneChild(goModUnit, goProfileTabCopy, "Header:"+ key); goHeaderButton.SetActive(true); goHeaderButton.AddComponent<UIDragScrollView>().scrollView = uiScrollView; UIButton uiHeaderButton = goHeaderButton.GetComponent<UIButton>(); EventDelegate.Set(uiHeaderButton.onClick, new EventDelegate.Callback(this.OnClickHeaderButton)); setButtonColor(uiHeaderButton, mp.IsToggle(key) ? mp.bEnabled[key] : false ); // 白地Sprite UISprite uiSpriteHeaderButton = goHeaderButton.GetComponent<UISprite>(); uiSpriteHeaderButton.type = UIBasicSprite.Type.Sliced; uiSpriteHeaderButton.SetDimensions(conWidth, 40); UILabel uiLabelHeader = FindChild(goHeaderButton, "Name").GetComponent<UILabel>(); uiLabelHeader.width = uiSpriteHeaderButton.width - 20; uiLabelHeader.height = 30; uiLabelHeader.trueTypeFont = font; uiLabelHeader.fontSize = 22; uiLabelHeader.spacingX = 0; uiLabelHeader.multiLine = false; uiLabelHeader.overflowMethod = UILabel.Overflow.ClampContent; uiLabelHeader.supportEncoding= true; uiLabelHeader.text = "[000000]"+ modeDesc +"[-]"; uiLabelHeader.gameObject.AddComponent<UIDragScrollView>().scrollView = uiScrollView; // 金枠Sprite UISprite uiSpriteHeaderCursor = FindChild(goHeaderButton,"SelectCursor").GetComponent<UISprite>(); uiSpriteHeaderCursor.gameObject.SetActive( mp.IsToggle(key) ? mp.bEnabled[key] : false ); NGUITools.UpdateWidgetCollider(goHeaderButton); // スライダーならUndo/Resetボタンとスライダー追加 if (mp.IsSlider(key)) { uiSpriteHeaderButton.SetDimensions((int)(conWidth*0.8f), 40); uiLabelHeader.width = uiSpriteHeaderButton.width - 20; uiHeaderButton.transform.localPosition = new Vector3(-conWidth*0.1f, 0f, 0f); // Undoボタン GameObject goUndo = SetCloneChild(goModUnit, goProfileTabCopy, "Undo:" + key); goUndo.transform.localPosition = new Vector3(conWidth*0.4f+2, 10.5f, 0f); goUndo.AddComponent<UIDragScrollView>().scrollView = uiScrollView; UISprite uiSpriteUndo = goUndo.GetComponent<UISprite>(); uiSpriteUndo.SetDimensions((int)(conWidth*0.2f)-2, 19); UILabel uiLabelUndo = FindChild(goUndo,"Name").GetComponent<UILabel>(); uiLabelUndo.width = uiSpriteUndo.width - 10; uiLabelUndo.fontSize = 14; uiLabelUndo.spacingX = 0; uiLabelUndo.supportEncoding = true; uiLabelUndo.text = "[111111]Undo"; UIButton uiButtonUndo = goUndo.GetComponent<UIButton>(); uiButtonUndo.defaultColor = new Color(1f, 1f, 1f, 0.8f); EventDelegate.Set(uiButtonUndo.onClick, new EventDelegate.Callback(this.OnClickUndoButton)); FindChild(goUndo,"SelectCursor").GetComponent<UISprite>().SetDimensions(16,16); FindChild(goUndo,"SelectCursor").SetActive(false); NGUITools.UpdateWidgetCollider(goUndo); goUndo.SetActive(true); // Resetボタン GameObject goReset = SetCloneChild(goModUnit, goProfileTabCopy, "Reset:" + key); goReset.AddComponent<UIDragScrollView>().scrollView = uiScrollView; goReset.transform.localPosition = new Vector3(conWidth*0.4f+2, -10.5f, 0f); UISprite uiSpriteReset = goReset.GetComponent<UISprite>(); uiSpriteReset.SetDimensions((int)(conWidth*0.2f)-2, 19); UILabel uiLabelReset = FindChild(goReset,"Name").GetComponent<UILabel>(); uiLabelReset.width = uiSpriteReset.width - 10; uiLabelReset.fontSize = 14; uiLabelReset.spacingX = 0; uiLabelReset.supportEncoding = true; uiLabelReset.text = "[111111]Reset"; UIButton uiButtonReset = goReset.GetComponent<UIButton>(); uiButtonReset.defaultColor = new Color(1f, 1f, 1f, 0.8f); EventDelegate.Set(uiButtonReset.onClick, new EventDelegate.Callback(this.OnClickResetButton)); FindChild(goReset,"SelectCursor").GetComponent<UISprite>().SetDimensions(16,16); FindChild(goReset,"SelectCursor").SetActive(false); NGUITools.UpdateWidgetCollider(goReset); goReset.SetActive(true); for (int j=0; j<mp.ValCount(key); j++) { string prop = mp.sPropName[key][j]; if (!mp.bVVisible[key][prop]) continue; float value = mp.fValue[key][prop]; float vmin = mp.fVmin[key][prop]; float vmax = mp.fVmax[key][prop]; string label = mp.sLabel[key][prop]; string vType = mp.sVType[key][prop]; // スライダーをModUnitに追加 GameObject goSliderUnit = SetCloneChild(goModUnit, goTestSliderUnit, "SliderUnit"); goSliderUnit.transform.localPosition = new Vector3(0f, j * - 70f - uiSpriteHeaderButton.height-20f, 0f); goSliderUnit.AddComponent<UIDragScrollView>().scrollView = uiScrollView; // フレームサイズ goSliderUnit.GetComponent<UISprite>().SetDimensions(conWidth, 50); // スライダー設定 UISlider uiModSlider = FindChild(goSliderUnit,"Slider").GetComponent<UISlider>(); uiModSlider.name = "Slider:"+ key +":"+ prop; uiModSlider.value = codecSliderValue(key, prop); if (vType == "int") uiModSlider.numberOfSteps = (int)(vmax - vmin + 1); EventDelegate.Add(uiModSlider.onChange, new EventDelegate.Callback(this.OnChangeSlider)); // スライダーラベル設定 FindChild(goSliderUnit,"Label").GetComponent<UILabel>().text = label; FindChild(goSliderUnit,"Label").AddComponent<UIDragScrollView>().scrollView = uiScrollView; // スライダー値ラベル参照取得 GameObject goValueLabel = FindChild(goSliderUnit,"Value"); goValueLabel.name = "Value:"+ key +":"+ prop; uiValueLable[key][prop] = goValueLabel.GetComponent<UILabel>(); uiValueLable[key][prop].multiLine = false; EventDelegate.Set(goValueLabel.GetComponent<UIInput>().onSubmit, this.OnSubmitSliderValueInput); // スライダー有効状態設定 //goSliderUnit.SetActive( !mp.IsToggle(key) || mp.bEnabled[key] && mp.CheckWS(key) ); goSliderUnit.SetActive(false); } } // 金枠Sprite uiSpriteHeaderCursor.type = UIBasicSprite.Type.Sliced; uiSpriteHeaderCursor.SetDimensions(uiSpriteHeaderButton.width - 4, uiSpriteHeaderButton.height - 4); } #endregion uiTable.Reposition(); goAMSPanel.SetActive(false); //WriteTrans("UI Root"); } catch(Exception ex) { Debug.Log(LogLabel +"initialize()"+ ex); return false;} return true; }
private void CreateObjects() { this.mContentForDetailInfo = base.transform.Find("rightInfoPanel").gameObject; this.mRightInfoTable = base.transform.Find("rightInfoPanel/contents").gameObject.AddComponent<UITable>(); this.mRightInfoTable.columns = 1; this.mRightInfoTable.direction = UITable.Direction.Down; this.mRightInfoTable.sorting = UITable.Sorting.Alphabetic; this.mRightInfoTable.hideInactive = true; this.mRightInfoTable.keepWithinPanel = true; this.mRightInfoTable.padding = new Vector2(0f, 2f); this.mScrollBar = base.transform.Find("infoScrollBar").GetComponent<UIScrollBar>(); this.mContentForHowGet = base.transform.Find("rightInfoPanel2").gameObject; this.mSuiPianTxt = this.mContentForHowGet.transform.Find("txt0").GetComponent<UILabel>(); this.mSuiPianTxt.gameObject.SetActive(false); this.mRightInfoTableForHowGet = base.transform.Find("rightInfoPanel2/contents").gameObject.AddComponent<GUIPetInfoSceneHowGetTable>(); this.mRightInfoTableForHowGet.maxPerLine = 1; this.mRightInfoTableForHowGet.arrangement = UICustomGrid.Arrangement.Vertical; this.mRightInfoTableForHowGet.cellWidth = 360f; this.mRightInfoTableForHowGet.cellHeight = 76f; this.mRightInfoTableForHowGet.gapHeight = 4f; this.mRightInfoTableForHowGet.gapWidth = 0f; Transform transform = this.mRightInfoTable.transform.Find("a"); this.mHpNum = transform.Find("hpTxt/num").GetComponent<UILabel>(); this.mAttackNum = transform.Find("attackTxt/num").GetComponent<UILabel>(); this.mWufangNum = transform.Find("wufangTxt/num").GetComponent<UILabel>(); this.mFafangNum = transform.Find("fafangTxt/num").GetComponent<UILabel>(); this.mSkillGo = this.mRightInfoTable.transform.Find("b").gameObject; this.mSkillLayer = this.mSkillGo.transform.Find("summonSkill").gameObject.AddComponent<GUIPetInfoSkillLayer>(); this.mSkillLayer.Init(true, true); Transform transform2 = this.mRightInfoTable.transform.Find("c"); this.mRelationBgSp = transform2.GetComponent<UISprite>(); this.mTianFuSp = this.mRightInfoTable.transform.Find("d").GetComponent<UISprite>(); this.mTianFuDesc = this.mTianFuSp.transform.Find("desc").GetComponent<UILabel>(); this.mPetDescSp = this.mRightInfoTable.transform.Find("e").GetComponent<UISprite>(); this.mPetDesc = this.mPetDescSp.transform.Find("desc").GetComponent<UILabel>(); this.mSuiPianState = base.transform.Find("suiPianState").gameObject; Transform transform3 = this.mSuiPianState.transform; this.mSuiPianStateBg = transform3.Find("tab0SpBg").gameObject; for (int i = 0; i < 2; i++) { this.mTab0s[i] = transform3.Find(string.Format("tab{0}", i)).gameObject; UIEventListener expr_346 = UIEventListener.Get(this.mTab0s[i]); expr_346.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_346.onClick, new UIEventListener.VoidDelegate(this.OnTab0Click)); this.mTab1s[i] = transform3.Find(string.Format("tabF{0}", i)).gameObject; } this.mGUISimpleSM = new GUISimpleSM<string, string>("init"); this.mGUISimpleSM.Configure("init").Permit("onState0", "state0").Permit("onState1", "state1").Permit("onState2", "state2"); this.mGUISimpleSM.Configure("state0").Permit("onState1", "state1").OnEntry(delegate(GUISimpleSM<string, string>.Transition t) { this.OnEnterState0(); }); this.mGUISimpleSM.Configure("state1").Permit("onState0", "state0").OnEntry(delegate(GUISimpleSM<string, string>.Transition t) { this.OnEnterState1(); }); this.mGUISimpleSM.Configure("state2").OnEntry(delegate(GUISimpleSM<string, string>.Transition t) { this.OnEnterState2(); }); }
private void CreateObjects() { this.mbagHideGo = base.transform.Find("summonBag/bagHide").gameObject; this.mScrollBar = base.transform.Find("summonBag/bgPanelScrollBar").GetComponent<UIScrollBar>(); this.mSW = base.transform.Find("summonBag/bagPanel").gameObject.AddComponent<UICollectionScrollView>(); this.mSW.contentPivot = UIWidget.Pivot.TopLeft; this.mSW.movement = UIScrollView.Movement.Vertical; this.mSW.dragEffect = UIScrollView.DragEffect.MomentumAndSpring; this.mSW.scrollWheelFactor = 1f; this.mSW.momentumAmount = 35f; this.mSW.restrictWithinPanel = true; this.mSW.disableDragIfFits = true; this.mSW.smoothDragStart = true; this.mSW.iOSDragEmulation = true; this.mSW.verticalScrollBar = this.mScrollBar; this.mSW.showScrollBars = UIScrollView.ShowCondition.OnlyIfNeeded; this.mCollectionTable2 = base.transform.Find("summonBag/bagPanel/bagContents").gameObject.AddComponent<UICollectionBetterTable>(); this.mCollectionTable2.InitWithBaseLayer(this); this.mAllCheck = base.transform.Find("allBtn").GetComponent<UIToggle>(); EventDelegate.Add(this.mAllCheck.onChange, new EventDelegate.Callback(this.OnFilterChanged)); UIToggle component = base.transform.Find("fireBtn").GetComponent<UIToggle>(); EventDelegate.Add(component.onChange, new EventDelegate.Callback(this.OnFilterChanged)); UIToggle component2 = base.transform.Find("waterBtn").GetComponent<UIToggle>(); EventDelegate.Add(component2.onChange, new EventDelegate.Callback(this.OnFilterChanged)); UIToggle component3 = base.transform.Find("woodBtn").GetComponent<UIToggle>(); EventDelegate.Add(component3.onChange, new EventDelegate.Callback(this.OnFilterChanged)); UIToggle component4 = base.transform.Find("lightBtn").GetComponent<UIToggle>(); EventDelegate.Add(component4.onChange, new EventDelegate.Callback(this.OnFilterChanged)); UIToggle component5 = base.transform.Find("darkBtn").GetComponent<UIToggle>(); EventDelegate.Add(component5.onChange, new EventDelegate.Callback(this.OnFilterChanged)); this.mCollectionTipTxt = base.transform.Find("tipTxt").GetComponent<UILabel>(); }
private void OnVerticalBar(UIScrollBar sb) { if (!this.mIgnoreCallbacks) { float single = (this.horizontalScrollBar == null ? 0f : this.horizontalScrollBar.scrollValue); this.SetDragAmount(single, (this.verticalScrollBar == null ? 0f : this.verticalScrollBar.scrollValue), false); } }
public ScrollItem(UIScrollBar bar, EMorphItem type) { mScrollBar = bar; mType = type; }
/// <summary> /// Triggered by the scroll bars when they change. /// </summary> void OnScrollbarChanged(UIScrollBar sb) { if (!mIgnoreCallbacks) { float x = (horizontalScrollBar != null) ? horizontalScrollBar.scrollValue : relativePositionOnReset.x; float y = (verticalScrollBar != null) ? verticalScrollBar.scrollValue : relativePositionOnReset.y; SetDragAmount(x, y, false); } }
/// <summary> /// Triggered by the vertical scroll bar when it changes. /// </summary> void OnVerticalBar(UIScrollBar sb) { OnScrollbarChanged(sb); }
/// <summary> /// Triggered by the vertical scroll bar when it changes. /// </summary> void OnVerticalBar(UIScrollBar sb) { if (!mIgnoreCallbacks) { float x = (horizontalScrollBar != null) ? horizontalScrollBar.scrollValue : 0f; float y = (verticalScrollBar != null) ? verticalScrollBar.scrollValue : 0f; SetDragAmount(x, y, false); } }
public static bool GetBrowserObjectScrollbar(Transform browserObjectTransform, out UIScrollBar scrollBar) { scrollBar = null; int maxLoops = 10; int currentLoop = 0; while ((currentLoop < maxLoops) && (browserObjectTransform != null) && browserObjectTransform.CompareTag(Globals.TagBrowserObject)) { browserObjectTransform = browserObjectTransform.parent; currentLoop++; //just in case } UIDraggablePanel panel = null; if (browserObjectTransform != null && browserObjectTransform.CompareTag(Globals.TagActiveObject) && browserObjectTransform.gameObject.HasComponent <UIDraggablePanel>(out panel)) { scrollBar = panel.verticalScrollBar; } return(scrollBar != null); }