static public int set_onInitializeItem(IntPtr l) { try { UIWrapContent self = (UIWrapContent)checkSelf(l); UIWrapContent.OnInitializeItem v; int op = LuaDelegation.checkDelegate(l, 2, out v); if (op == 0) { self.onInitializeItem = v; } else if (op == 1) { self.onInitializeItem += v; } else if (op == 2) { self.onInitializeItem -= v; } pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public static int set_updateHandler(IntPtr l) { int result; try { UIWrapContent uIWrapContent = (UIWrapContent)LuaObject.checkSelf(l); WrapContentItemUpdateEventHandler wrapContentItemUpdateEventHandler; int num = LuaDelegation.checkDelegate(l, 2, out wrapContentItemUpdateEventHandler); if (num == 0) { uIWrapContent.updateHandler = wrapContentItemUpdateEventHandler; } else if (num == 1) { UIWrapContent expr_30 = uIWrapContent; expr_30.updateHandler = (WrapContentItemUpdateEventHandler)Delegate.Combine(expr_30.updateHandler, wrapContentItemUpdateEventHandler); } else if (num == 2) { UIWrapContent expr_53 = uIWrapContent; expr_53.updateHandler = (WrapContentItemUpdateEventHandler)Delegate.Remove(expr_53.updateHandler, wrapContentItemUpdateEventHandler); } LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static void IntilizationForWrapContent(UIWrapContent content , int number, GameObject itemPre, List<GameObject> list,bool active , float time, float time2, Action<List<GameObject>> callback = null) { for (int i = 0; i < number; i++) { GameObject gameO = (GameObject)GameObject.Instantiate(itemPre); gameO.transform.parent = content.transform; gameO.transform.localScale = Vector3.one; gameO.transform.localPosition = Vector3.one; gameO.name = i.ToString(); list.Add(gameO); } Utility.instance.WaitForSecs(time2, () => { for (int i = 0; i < list.Count; i++) { if (list[i] != null) list[i].SetActive(active); } }); Utility.instance.WaitForSecs(time, () => { content.WrapContent(); }); }
private static int set_onInitializeItem(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIWrapContent uIWrapContent = (UIWrapContent)obj; LuaTypes luaTypes = LuaDLL.lua_type(L, 2); UIWrapContent.OnInitializeItem onInitializeItem; if (luaTypes != LuaTypes.LUA_TFUNCTION) { onInitializeItem = (UIWrapContent.OnInitializeItem)ToLua.CheckObject(L, 2, typeof(UIWrapContent.OnInitializeItem)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); onInitializeItem = (DelegateFactory.CreateDelegate(typeof(UIWrapContent.OnInitializeItem), func) as UIWrapContent.OnInitializeItem); } uIWrapContent.onInitializeItem = onInitializeItem; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index onInitializeItem on a nil value"); } return(result); }
static int set_onInitializeItem(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIWrapContent obj = (UIWrapContent)o; UIWrapContent.OnInitializeItem arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (UIWrapContent.OnInitializeItem)ToLua.CheckObject(L, 2, typeof(UIWrapContent.OnInitializeItem)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(UIWrapContent.OnInitializeItem), func) as UIWrapContent.OnInitializeItem; } obj.onInitializeItem = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onInitializeItem on a nil value" : e.Message)); } }
private UIWrapContentHelper(UIWrapContent uiWrapContent) { if (uiWrapContent == null) { Debug.LogError("UIWrapContentHelper 传入了NULL"); return; } _wrapContent = uiWrapContent; //_wrapContent.hideInactive = false; _wrapContent.onInitializeItem = OnInitItem; //NOTE NGUI 3.7.x以上版本才有此功能 //NOTE UIPanel 建议挂在UIWrapContent的父级,NGUI3.9.7非父级我这儿出现异怪现象 _panel = _wrapContent.gameObject.GetComponent <UIPanel>(); var panelParent = _wrapContent.transform.parent; if (_panel == null && panelParent != null) { _panel = panelParent.GetComponent <UIPanel>(); } if (_panel == null) { Debug.LogError(uiWrapContent.name + "的父节点没有UIPanel"); return; } _scrollView = _panel.GetComponent <UIScrollView>(); _initPanelClipOffset = _panel.clipOffset; _initPanelLocalPos = _panel.cachedTransform.localPosition; }
protected override void OnAwake() { btnReturn = transform.Find("Top/Btn_Return").gameObject; btnChallenge = transform.Find("Bottom/Btn_Challenge").gameObject; mScrollView = transform.Find("View").GetComponent <UIScrollView>(); mWrapContent = transform.Find("View/Grid").GetComponent <UIWrapContent>(); }
static int SortBasedOnScrollMovement(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); UIWrapContent obj = (UIWrapContent)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIWrapContent"); obj.SortBasedOnScrollMovement(); return(0); }
static int WrapContent(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); UIWrapContent obj = (UIWrapContent)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIWrapContent"); obj.WrapContent(); return(0); }
// Use this for initialization void Awake() { //获取脚本 _wrapScript = _wrap.GetComponent <UIWrapContent>(); //绑定方法 _wrapScript.onInitializeItem = OnUpdateItem; }
void SetWrapContent(UIGrid grid, List <ItemDataManager.ItemData> dataList, Dictionary <int, PropsItem> dataDic, UIWrapContent.OnInitializeItem OnUpdateItemMain) { grid.enabled = true; int tankCont = dataList.Count; int gridCont = grid.GetChildList().Count; int itemCount = 0; if (tankCont % 2 == 0) { itemCount = tankCont / 2; } else { itemCount = tankCont / 2 + 1; } if (itemCount <= 3) { if (grid.gameObject.GetComponent <UIWrapContent>()) { NGUITools.Destroy(grid.gameObject.GetComponent <UIWrapContent>()); } if (gridCont != itemCount) { StartCoroutine(CreateUnit(grid, dataList, dataDic)); } } else { UIWrapContent wrap = null; if (grid.gameObject.GetComponent <UIWrapContent>()) { wrap = grid.gameObject.GetComponent <UIWrapContent>(); } else { grid.gameObject.AddComponent <UIWrapContent>(); wrap = grid.gameObject.GetComponent <UIWrapContent>(); } _wrapList.Add(wrap); if (gridCont != 4) { if (grid != null) { grid.DestoryAllChildren(); } CreateWrapUnit(grid, 4); if (wrap != null) { //绑定方法 wrap.itemSize = (int)grid.cellHeight; wrap.minIndex = -(itemCount - 1); wrap.maxIndex = 0; wrap.onInitializeItem = OnUpdateItemMain; wrap.SortAlphabetically(); } } } }
protected override void Start() { base.Start(); UIWrapContent wrap = cachedTransform.GetComponentInChildren <UIWrapContent>(); if (wrap != null) { itemHeight = wrap.itemSize; } }
static public int SortBasedOnScrollMovement(IntPtr l) { try { UIWrapContent self = (UIWrapContent)checkSelf(l); self.SortBasedOnScrollMovement(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int SortAlphabetically(IntPtr l) { try { UIWrapContent self = (UIWrapContent)checkSelf(l); self.SortAlphabetically(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
protected override void OnAwakeInitUI() { if (mUIMainModel == null) { mUIMainModel = UIModelMgr.Instance.GetModel <UIMainModel>(); mUIMainModel.ValueUpdateEvent += OnValueUpdateEvent; } mUIWrapContent = CacheTrans.FindComponent <UIWrapContent>("Root/MessageGroup/ScrollView/Grid"); mScrollGrid = CacheTrans.FindComponent <ScrollGrid>("Root/MessageGroup/ScrollView/Grid"); CacheTrans.GetUIEventListener("Root/TitleGroup/BtnReturn").onClick += OnReturnClick; mUIWrapContent.onInitializeItem = onInitializeItem; }
static public int get_cullContent(IntPtr l) { try { UIWrapContent self = (UIWrapContent)checkSelf(l); pushValue(l, true); pushValue(l, self.cullContent); return(2); } catch (Exception e) { return(error(l, e)); } }
public override void OnInspectorGUI() { GUILayout.Space(6f); NGUIEditorTools.SetLabelWidth(90f); string fieldName = "Item Size"; string error = null; UIScrollView sv = null; if (!serializedObject.isEditingMultipleObjects) { UIWrapContent list = target as UIWrapContent; sv = NGUITools.FindInParents <UIScrollView>(list.gameObject); if (sv == null) { error = "UIWrappedList needs a Scroll View on its parent in order to work properly"; } else if (sv.movement == UIScrollView.Movement.Horizontal) { fieldName = "Item Width"; } else if (sv.movement == UIScrollView.Movement.Vertical) { fieldName = "Item Height"; } else { error = "Scroll View needs to be using Horizontal or Vertical movement"; } } serializedObject.Update(); GUILayout.BeginHorizontal(); NGUIEditorTools.DrawProperty(fieldName, serializedObject, "itemSize", GUILayout.Width(130f)); GUILayout.Label("pixels"); GUILayout.EndHorizontal(); NGUIEditorTools.DrawProperty("Cull Content", serializedObject, "cullContent"); NGUIEditorTools.DrawProperty("isRise", serializedObject, "isRise"); if (!string.IsNullOrEmpty(error)) { EditorGUILayout.HelpBox(error, MessageType.Error); if (sv != null && GUILayout.Button("Select the Scroll View")) { Selection.activeGameObject = sv.gameObject; } } serializedObject.ApplyModifiedProperties(); }
public List <string> FindWidgetTypes() { List <string> types = new List <string>(); #if NGUI UIRect[] rectArr = this.gameObject.GetComponents <UIRect>(); foreach (UIRect rect in rectArr) { types.Add(rect.GetType().FullName); } UIWidgetContainer[] container = this.gameObject.GetComponents <UIWidgetContainer>(); foreach (UIWidgetContainer widget in container) { types.Add(widget.GetType().FullName); } UIInput input = this.gameObject.GetComponent <UIInput>(); if (input) { types.Add(input.GetType().FullName); } UIWrapContent wrap = this.gameObject.GetComponent <UIWrapContent>(); if (wrap) { types.Add(wrap.GetType().FullName); } #elif UGUI Graphic[] graphics = this.gameObject.GetComponents <Graphic>(); foreach (Graphic g in graphics) { types.Add(g.GetType().Name); } UIBehaviour[] uiBehavs = this.gameObject.GetComponents <UIBehaviour>(); foreach (UIBehaviour uib in uiBehavs) { types.Add(uib.GetType().Name); } #endif //if (types.Count <= 0) { types.Add("GameObject"); types.Add("Transform"); } return(types); }
static int SortBasedOnScrollMovement(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UIWrapContent obj = (UIWrapContent)ToLua.CheckObject(L, 1, typeof(UIWrapContent)); obj.SortBasedOnScrollMovement(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int SortAlphabetically(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UIWrapContent obj = (UIWrapContent)ToLua.CheckObject(L, 1, typeof(UIWrapContent)); obj.SortAlphabetically(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void SetWrapContent(UIGrid grid, List <TankDataManager.UnitData> dataList, Dictionary <int, StrengthenTankItem> dataDic, UIWrapContent.OnInitializeItem OnUpdateItemMain) { int tankCont = dataList.Count; int gridCont = grid.GetChildList().Count; if (tankCont <= 7) { if (grid.gameObject.GetComponent <UIWrapContent>()) { NGUITools.Destroy(grid.gameObject.GetComponent <UIWrapContent>()); } if (gridCont != tankCont) { StartCoroutine(CreateUnit(grid, dataList, dataDic)); } _scrollview.enabled = false; } else { _scrollview.enabled = true; UIWrapContent wrap = null; if (grid.gameObject.GetComponent <UIWrapContent>()) { wrap = grid.gameObject.GetComponent <UIWrapContent>(); } else { grid.gameObject.AddComponent <UIWrapContent>(); wrap = grid.gameObject.GetComponent <UIWrapContent>(); } if (gridCont != 8) { if (grid != null) { grid.DestoryAllChildren(); } CreateWrapUnit(grid, 8); if (wrap != null) { //绑定方法 wrap.itemSize = (int)grid.cellWidth; wrap.minIndex = 0; wrap.maxIndex = (tankCont - 1); wrap.onInitializeItem = OnUpdateItemMain; wrap.enabled = true; wrap.SortAlphabetically(); } } } }
static int WrapContent(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UIWrapContent obj = (UIWrapContent)ToLua.CheckObject <UIWrapContent>(L, 1); obj.WrapContent(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int set_cullContent(IntPtr l) { try { UIWrapContent self = (UIWrapContent)checkSelf(l); System.Boolean v; checkType(l, 2, out v); self.cullContent = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_itemSize(IntPtr l) { try { UIWrapContent self = (UIWrapContent)checkSelf(l); System.Int32 v; checkType(l, 2, out v); self.itemSize = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public override void UpdateUI() { SetGrid(UI.GRD_PICKER, "PickerItem", desc.text.Length, false, delegate(int i, Transform t, bool is_recycle) { SetLabelText(t, UI.LBL_PICKER, desc.text[i]); }); UIWrapContent component = base.GetComponent <UIWrapContent>((Enum)UI.GRD_PICKER); if (component != null) { component.set_enabled(desc.enableLoop); } SetCenterOnChildFunc((Enum)UI.GRD_PICKER, (UICenterOnChild.OnCenterCallback)OnCenter); SetCenter((Enum)UI.GRD_PICKER, selectIndex, false); }
/* protected - Override & Unity API */ protected override void OnAwake() { base.OnAwake(); _pPanel = GetComponent <UIPanel>(); _pUIScrollView = GetComponent <UIScrollView>(); _pUIWrapContent = GetComponentInChildren <UIWrapContent>(); _pUIWrapContent.onInitializeItem = OnSetItem; GetComponentsInChildren <CNGUIScrollViewItem>(_listScrollViewItem); _iCountScrollItem = _listScrollViewItem.Count; _v2SpringFirstPos = _pPanel.transform.localPosition; }
private void Awake() { this.mSliderTipLabel = base.transform.FindChild("SlideTip").gameObject; this.mPanel = base.transform.FindChild("Scroll View").GetComponent <UIPanel>(); this.mScrollView = this.mPanel.GetComponent <UIScrollView>(); this.mGrid = base.transform.FindChild("Scroll View/Grid").GetComponent <UIGrid>(); this.mCenterOnChild = this.mGrid.GetComponent <UICenterOnChild>(); this.mWrapContent = this.mGrid.GetComponent <UIWrapContent>(); this.mMedalName = base.transform.FindChild("AchiName").GetComponent <UILabel>(); this.mMedalDesc = base.transform.FindChild("AchiDesc").GetComponent <UILabel>(); this.mShine = base.transform.FindChild("shine").GetComponent <UITexture>(); this.mPanel.alpha = 0.01f; this.mObjectCache = base.transform.Find("Container"); this.mCenterOnChild.onFinished = new SpringPanel.OnFinished(this.ResetTrans); MobaMessageManager.RegistMessage((ClientMsg)23037, new MobaMessageFunc(this.onMsg_showAchievement)); }
static int get_itemSize(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIWrapContent obj = (UIWrapContent)o; int ret = obj.itemSize; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index itemSize on a nil value")); } }
static int set_onInitializeItem(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIWrapContent obj = (UIWrapContent)o; UIWrapContent.OnInitializeItem arg0 = (UIWrapContent.OnInitializeItem)ToLua.CheckDelegate <UIWrapContent.OnInitializeItem>(L, 2); obj.onInitializeItem = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onInitializeItem on a nil value")); } }
static int set_cullContent(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIWrapContent obj = (UIWrapContent)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.cullContent = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index cullContent on a nil value")); } }
static int set_maxIndex(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIWrapContent obj = (UIWrapContent)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.maxIndex = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index maxIndex on a nil value")); } }