public GButton() { sound = UIConfig.buttonSound; soundVolumeScale = UIConfig.buttonSoundVolumeScale; changeStateOnClick = true; _downEffectValue = 0.8f; _title = string.Empty; }
public GButton() { pageOption = new PageOption(); sound = UIConfig.buttonSound; soundVolumeScale = UIConfig.buttonSoundVolumeScale; changeStateOnClick = true; _downEffectValue = 0.8f; _title = string.Empty; onChanged = new EventListener(this, "onChanged"); }
public static void ClearResourceRefs() { UIConfig.defaultFont = ""; UIConfig.buttonSound = null; UIConfig.globalModalWaiting = null; UIConfig.horizontalScrollBar = null; UIConfig.loaderErrorSign = null; UIConfig.popupMenu = null; UIConfig.popupMenu_seperator = null; UIConfig.tooltipsWin = null; UIConfig.verticalScrollBar = null; UIConfig.windowModalWaiting = null; }
static int set_buttonSound(IntPtr L) { try { FairyGUI.NAudioClip arg0 = (FairyGUI.NAudioClip)ToLua.CheckObject <FairyGUI.NAudioClip>(L, 2); FairyGUI.UIConfig.buttonSound = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_sound(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GButton obj = (FairyGUI.GButton)o; FairyGUI.NAudioClip arg0 = (FairyGUI.NAudioClip)ToLua.CheckObject <FairyGUI.NAudioClip>(L, 2); obj.sound = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index sound on a nil value")); } }
static int get_sound(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FairyGUI.GButton obj = (FairyGUI.GButton)o; FairyGUI.NAudioClip ret = obj.sound; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index sound on a nil value")); } }
override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos) { base.Setup_AfterAdd(buffer, beginPos); if (!buffer.Seek(beginPos, 6)) { Update(_value); return; } if ((ObjectType)buffer.ReadByte() != packageItem.objectType) { Update(_value); return; } _value = buffer.ReadInt(); _max = buffer.ReadInt(); if (buffer.version >= 2) { _min = buffer.ReadInt(); } if (buffer.version >= 5) { string sound = buffer.ReadS(); if (!string.IsNullOrEmpty(sound)) { float volumeScale = buffer.ReadFloat(); displayObject.onClick.Add(() => { NAudioClip audioClip = UIPackage.GetItemAssetByURL(sound) as NAudioClip; if (audioClip != null && audioClip.nativeClip != null) { Stage.inst.PlayOneShotSound(audioClip.nativeClip, volumeScale); } }); } else { buffer.Skip(4); } } Update(_value); }
override protected void ConstructExtension(ByteBuffer buffer) { buffer.Seek(0, 6); _mode = (ButtonMode)buffer.ReadByte(); string str = buffer.ReadS(); if (str != null) { sound = UIPackage.GetItemAssetByURL(str) as NAudioClip; } soundVolumeScale = buffer.ReadFloat(); _downEffect = buffer.ReadByte(); _downEffectValue = buffer.ReadFloat(); if (_downEffect == 2) { SetPivot(0.5f, 0.5f, this.pivotAsAnchor); } _buttonController = GetController("button"); _titleObject = GetChild("title"); _iconObject = GetChild("icon"); if (_titleObject != null) { _title = _titleObject.text; } if (_iconObject != null) { _icon = _iconObject.icon; } if (_mode == ButtonMode.Common) { SetState(UP); } displayObject.onRollOver.Add(__rollover); displayObject.onRollOut.Add(__rollout); displayObject.onTouchBegin.Add(__touchBegin); displayObject.onTouchEnd.Add(__touchEnd); displayObject.onRemovedFromStage.Add(__removedFromStage); displayObject.onClick.Add(__click); }
public void Load() { int cnt = Items.Count; for (int i = 0; i < cnt; i++) { ConfigValue value = Items[i]; if (!value.valid) { continue; } switch ((UIConfig.ConfigKey)i) { case ConfigKey.ButtonSound: if (Application.isPlaying) { UIConfig.buttonSound = UIPackage.GetItemAssetByURL(value.s) as NAudioClip; } break; case ConfigKey.ButtonSoundVolumeScale: UIConfig.buttonSoundVolumeScale = value.f; break; case ConfigKey.ClickDragSensitivity: UIConfig.clickDragSensitivity = value.i; break; case ConfigKey.DefaultComboBoxVisibleItemCount: UIConfig.defaultComboBoxVisibleItemCount = value.i; break; case ConfigKey.DefaultFont: UIConfig.defaultFont = value.s; break; case ConfigKey.DefaultScrollBarDisplay: UIConfig.defaultScrollBarDisplay = (ScrollBarDisplayType)value.i; break; case ConfigKey.DefaultScrollBounceEffect: UIConfig.defaultScrollBounceEffect = value.b; break; case ConfigKey.DefaultScrollStep: UIConfig.defaultScrollStep = value.i; break; case ConfigKey.DefaultScrollTouchEffect: UIConfig.defaultScrollTouchEffect = value.b; break; case ConfigKey.GlobalModalWaiting: UIConfig.globalModalWaiting = value.s; break; case ConfigKey.HorizontalScrollBar: UIConfig.horizontalScrollBar = value.s; break; case ConfigKey.LoaderErrorSign: UIConfig.loaderErrorSign = value.s; break; case ConfigKey.ModalLayerColor: UIConfig.modalLayerColor = value.c; break; case ConfigKey.PopupMenu: UIConfig.popupMenu = value.s; break; case ConfigKey.PopupMenu_seperator: UIConfig.popupMenu_seperator = value.s; break; case ConfigKey.TooltipsWin: UIConfig.tooltipsWin = value.s; break; case ConfigKey.TouchDragSensitivity: UIConfig.touchDragSensitivity = value.i; break; case ConfigKey.TouchScrollSensitivity: UIConfig.touchScrollSensitivity = value.i; break; case ConfigKey.VerticalScrollBar: UIConfig.verticalScrollBar = value.s; break; case ConfigKey.WindowModalWaiting: UIConfig.windowModalWaiting = value.s; break; case ConfigKey.AllowSoftnessOnTopOrLeftSide: UIConfig.allowSoftnessOnTopOrLeftSide = value.b; break; case ConfigKey.InputCaretSize: UIConfig.inputCaretSize = value.i; break; case ConfigKey.InputHighlightColor: UIConfig.inputHighlightColor = value.c; break; case ConfigKey.DepthSupportForPaintingMode: UIConfig.depthSupportForPaintingMode = value.b; break; case ConfigKey.EnhancedTextOutlineEffect: UIConfig.enhancedTextOutlineEffect = value.b; break; case ConfigKey.Branch: UIPackage.branch = value.s; break; } } }
override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos) { base.Setup_AfterAdd(buffer, beginPos); if (!buffer.Seek(beginPos, 6)) { return; } if ((ObjectType)buffer.ReadByte() != packageItem.objectType) { return; } string str; str = buffer.ReadS(); if (str != null) { this.title = str; } str = buffer.ReadS(); if (str != null) { this.selectedTitle = str; } str = buffer.ReadS(); if (str != null) { this.icon = str; } str = buffer.ReadS(); if (str != null) { this.selectedIcon = str; } if (buffer.ReadBool()) { this.titleColor = buffer.ReadColor(); } int iv = buffer.ReadInt(); if (iv != 0) { this.titleFontSize = iv; } iv = buffer.ReadShort(); if (iv >= 0) { _relatedController = parent.GetControllerAt(iv); } _relatedPageId = buffer.ReadS(); str = buffer.ReadS(); if (str != null) { sound = UIPackage.GetItemAssetByURL(str) as NAudioClip; } if (buffer.ReadBool()) { soundVolumeScale = buffer.ReadFloat(); } this.selected = buffer.ReadBool(); }
override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos) { base.Setup_AfterAdd(buffer, beginPos); if (!buffer.Seek(beginPos, 6)) { return; } if ((ObjectType)buffer.ReadByte() != packageItem.objectType) { return; } string str; str = buffer.ReadS(); if (str != null) { this.title = str; } str = buffer.ReadS(); if (str != null) { this.icon = str; } if (buffer.ReadBool()) { this.titleColor = buffer.ReadColor(); } int iv = buffer.ReadInt(); if (iv != 0) { this.titleFontSize = iv; } if (buffer.ReadBool()) { GTextInput input = GetTextField() as GTextInput; if (input != null) { str = buffer.ReadS(); if (str != null) { input.promptText = str; } str = buffer.ReadS(); if (str != null) { input.restrict = str; } iv = buffer.ReadInt(); if (iv != 0) { input.maxLength = iv; } iv = buffer.ReadInt(); if (iv != 0) { input.keyboardType = iv; } if (buffer.ReadBool()) { input.displayAsPassword = true; } } else { buffer.Skip(13); } } if (buffer.version >= 5) { string sound = buffer.ReadS(); if (!string.IsNullOrEmpty(sound)) { float volumeScale = buffer.ReadFloat(); displayObject.onClick.Add(() => { NAudioClip audioClip = UIPackage.GetItemAssetByURL(sound) as NAudioClip; if (audioClip != null && audioClip.nativeClip != null) { Stage.inst.PlayOneShotSound(audioClip.nativeClip, volumeScale); } }); } else { buffer.Skip(4); } } }
override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos) { base.Setup_AfterAdd(buffer, beginPos); if (!buffer.Seek(beginPos, 6)) { return; } if ((ObjectType)buffer.ReadByte() != packageItem.objectType) { return; } string str; int itemCount = buffer.ReadShort(); for (int i = 0; i < itemCount; i++) { int nextPos = buffer.ReadUshort(); nextPos += buffer.position; _items.Add(buffer.ReadS()); _values.Add(buffer.ReadS()); str = buffer.ReadS(); if (str != null) { if (_icons == null) { _icons = new List <string>(); } _icons.Add(str); } buffer.position = nextPos; } str = buffer.ReadS(); if (str != null) { this.text = str; _selectedIndex = _items.IndexOf(str); } else if (_items.Count > 0) { _selectedIndex = 0; this.text = _items[0]; } else { _selectedIndex = -1; } str = buffer.ReadS(); if (str != null) { this.icon = str; } if (buffer.ReadBool()) { this.titleColor = buffer.ReadColor(); } int iv = buffer.ReadInt(); if (iv > 0) { visibleItemCount = iv; } _popupDirection = (PopupDirection)buffer.ReadByte(); iv = buffer.ReadShort(); if (iv >= 0) { _selectionController = parent.GetControllerAt(iv); } if (buffer.version >= 5) { str = buffer.ReadS(); if (str != null) { sound = UIPackage.GetItemAssetByURL(str) as NAudioClip; } soundVolumeScale = buffer.ReadFloat(); } }