////////////////////////////////////////////////// public void SetEZGUI(UIRadioBtn EZGUI) { EZGUI_RadioButton = EZGUI; EZGUI_RadioButton.useParentForGrouping = false; EZGUI_RadioButton.SetAnchor(0); SetValid(false); }
public override void Copy(SpriteRoot s, ControlCopyFlags flags) { base.Copy(s, flags); if (!(s is UIRadioBtn)) { return; } UIRadioBtn uIRadioBtn = (UIRadioBtn)s; if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State) { this.state = uIRadioBtn.state; this.prevTransition = uIRadioBtn.prevTransition; if (Application.isPlaying) { this.Value = uIRadioBtn.Value; } } if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings) { this.group = uIRadioBtn.group; this.defaultValue = uIRadioBtn.defaultValue; } if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation) { this.scriptWithMethodToInvoke = uIRadioBtn.scriptWithMethodToInvoke; this.methodToInvoke = uIRadioBtn.methodToInvoke; this.whenToInvoke = uIRadioBtn.whenToInvoke; this.delay = uIRadioBtn.delay; } if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound) { this.soundToPlay = uIRadioBtn.soundToPlay; } }
public static UIRadioBtn RadioBtn(Form form, string name, string imageKey, float width, float height) { UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey); if (uIBaseInfoLoader == null) { return(null); } GameObject gameObject = new GameObject(name); UIRadioBtn uIRadioBtn = gameObject.AddComponent <UIRadioBtn>(); uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIRadioBtn.gameObject.layer = GUICamera.UILayer; uIRadioBtn.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); uIRadioBtn.m_bPattern = uIBaseInfoLoader.Pattern; Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); uIRadioBtn.Setup(width, height, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect uvs = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); for (int i = 0; i <= (int)(uIBaseInfoLoader.ButtonCount - 1); i++) { uIRadioBtn.States[i].spriteFrames = new CSpriteFrame[1]; uIRadioBtn.States[i].spriteFrames[0] = new CSpriteFrame(); uvs.x += pixelToUVsWidth; uIRadioBtn.States[i].spriteFrames[0].uvs = uvs; uIRadioBtn.animations[i].SetAnim(uIRadioBtn.States[i], i); } uIRadioBtn.autoResize = false; uIRadioBtn.useParentForGrouping = false; uIRadioBtn.SetGroup(100 * form.WindowID); form.AddDictionaryControl(name, uIRadioBtn); form.InteractivePanel.MakeChild(uIRadioBtn.gameObject); uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIRadioBtn.gameObject.layer = GUICamera.UILayer; UIButton uIButton = UICreateControl.Button(name + "OverButton", imageKey + "_over", uIRadioBtn.width, uIRadioBtn.height); if (null != uIButton) { uIButton.Start(); BoxCollider component = uIButton.gameObject.GetComponent <BoxCollider>(); if (null != component) { UnityEngine.Object.Destroy(component); } form.InteractivePanel.MakeChild(uIButton.gameObject); uIRadioBtn.layers = new SpriteRoot[1]; for (int j = 0; j < 1; j++) { uIRadioBtn.layers[j] = uIButton; uIButton.transform.localPosition = uIRadioBtn.GetLocation(); } } uIRadioBtn.Start(); return(uIRadioBtn); }
void RoleMenuValueChanged(IUIObject obj) { UIRadioBtn radio = obj as UIRadioBtn; if (radio != null && radio.Value) { if (mRoleTypes.ContainsKey(radio.gameObject.name)) { mCurrentRoleType = (RoleType)(mRoleTypes[radio.gameObject.name]); OnChangedRoleType(mCurrentRoleType); } } }
void OperateMenuValueChanged(IUIObject obj) { UIRadioBtn radio = obj as UIRadioBtn; if (radio != null && radio.Value) { if (mOperateTypes.ContainsKey(radio.gameObject.name)) { mCurrentOperate = (OperateType)(mOperateTypes[radio.gameObject.name]); OnChangedOperator(mCurrentOperate); SelectedEquipChanged(mCurrentSelectedEquip); } } }
public void OnEquipSelectedChanged(IUIObject obj) { UIRadioBtn radio = obj as UIRadioBtn; if (radio != null && radio.Value) { if (mEquipIndexs.ContainsKey(radio.gameObject.name)) { int nSelected = mEquipIndexs[radio.gameObject.name]; if (nSelected != mCurrentSelectedEquip) { mCurrentSelectedEquip = nSelected; SelectedEquipChanged(mCurrentSelectedEquip); } } } }
void RoleMenuValueChanged(IUIObject obj) { UIRadioBtn radio = obj as UIRadioBtn; if (radio != null && radio.Value) { for (int i = 0; i < mRoleMenus.Count; i++) { if (radio == mRoleMenus[i]) { mCurrentRoleType = (RoleType)i; OnChangedRoleType(mCurrentRoleType); CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UPDATE_ATTRIRANDOM); return; } } } }
public override void Copy(SpriteRoot s, ControlCopyFlags flags) { base.Copy(s, flags); if (!(s is UIRadioBtn)) { return; } UIRadioBtn b = (UIRadioBtn)s; if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State) { state = b.state; prevTransition = b.prevTransition; if (Application.isPlaying) { Value = b.Value; } } if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings) { group = b.group; defaultValue = b.defaultValue; } if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation) { scriptWithMethodToInvoke = b.scriptWithMethodToInvoke; methodToInvoke = b.methodToInvoke; whenToInvoke = b.whenToInvoke; delay = b.delay; } if ((flags & ControlCopyFlags.Sound) == ControlCopyFlags.Sound) { soundToPlay = b.soundToPlay; } }
public static UIRadioBtn RadioBtn(string name, string imageKey, float width, float height) { UIBaseInfoLoader uIBaseInfoLoader = UIBaseFileManager.FindUIImageDictionary(name, imageKey); if (uIBaseInfoLoader == null) { return(null); } GameObject gameObject = new GameObject(name); UIRadioBtn uIRadioBtn = gameObject.AddComponent <UIRadioBtn>(); uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIRadioBtn.gameObject.layer = GUICamera.UILayer; uIRadioBtn.SetSpriteTile(uIBaseInfoLoader.Tile, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount, uIBaseInfoLoader.UVs.height); uIRadioBtn.m_bPattern = uIBaseInfoLoader.Pattern; Material material = (Material)CResources.Load(uIBaseInfoLoader.Material); uIRadioBtn.Setup(width, height, material); float pixelToUVsWidth = UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.width / (float)uIBaseInfoLoader.ButtonCount); Rect uvs = new Rect(UIBaseFileManager.GetPixelToUVsWidth(material, uIBaseInfoLoader.UVs.x) - pixelToUVsWidth, 1f - UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.y + uIBaseInfoLoader.UVs.height), pixelToUVsWidth, UIBaseFileManager.GetPixelToUVsHeight(material, uIBaseInfoLoader.UVs.height)); for (int i = 0; i <= (int)(uIBaseInfoLoader.ButtonCount - 1); i++) { uIRadioBtn.States[i].spriteFrames = new CSpriteFrame[1]; uIRadioBtn.States[i].spriteFrames[0] = new CSpriteFrame(); uvs.x += pixelToUVsWidth; uIRadioBtn.States[i].spriteFrames[0].uvs = uvs; uIRadioBtn.animations[i].SetAnim(uIRadioBtn.States[i], i); } uIRadioBtn.autoResize = false; uIRadioBtn.useParentForGrouping = false; uIRadioBtn.SetGroup(0); uIRadioBtn.SetAnchor(SpriteRoot.ANCHOR_METHOD.UPPER_LEFT); uIRadioBtn.gameObject.layer = GUICamera.UILayer; uIRadioBtn.Start(); return(uIRadioBtn); }
private void OnClickBattlePosSolSelect(IUIObject obj) { UIRadioBtn uIRadioBtn = (UIRadioBtn)obj; if (uIRadioBtn == null || !uIRadioBtn.Value) { return; } int num = (int)uIRadioBtn.Data; short num2 = (short)num; if (num2 == this.nSelectedBattelPos) { return; } if (this.nSelectedBattelPos < 0) { this.nSelectedBattelPos = num2; bool flag = false; for (int i = 0; i < 6; i++) { NkSoldierInfo nkSoldierInfo = this.m_kBattlePosSolList[i]; if (nkSoldierInfo != null && nkSoldierInfo.IsValid()) { if (this.nSelectedBattelPos == nkSoldierInfo.GetBattlePos()) { string empty = string.Empty; NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[] { NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1469"), "count", nkSoldierInfo.GetLevel().ToString() }); this.BattlePosSolName.Text = string.Format("{0}({1})", nkSoldierInfo.GetName(), empty); int num3 = nkSoldierInfo.GetEquipWeaponOrigin(); this.BattlePosSolWeapon1.Visible = (num3 > 0); if (num3 > 0) { this.BattlePosSolWeapon1.SetTexture(string.Format("Win_I_Weapon{0}", num3.ToString())); } num3 = nkSoldierInfo.GetEquipWeaponExtention(); this.BattlePosSolWeapon2.Visible = (num3 > 0); if (num3 > 0) { this.BattlePosSolWeapon2.SetTexture(string.Format("Win_I_Weapon{0}", num3.ToString())); } flag = true; break; } } } if (!flag) { this.BattlePosSolName.Text = string.Empty; this.BattlePosSolWeapon1.Visible = false; this.BattlePosSolWeapon2.Visible = false; } if (this.nSelectedBattelPos >= 0 && this.nSelectedBattelPos < 9) { this.BattlePosSelectedPos.SetLocation(this.BattlePosCoverImage[(int)this.nSelectedBattelPos].GetLocationX(), this.BattlePosCoverImage[(int)this.nSelectedBattelPos].GetLocationY(), -0.14f); this.BattlePosSelectedPos.Visible = true; } return; } NkSoldierInfo nkSoldierInfo2 = null; NkSoldierInfo nkSoldierInfo3 = null; short battlePos = -1; short battlePos2 = -1; for (int j = 0; j < 6; j++) { NkSoldierInfo nkSoldierInfo = this.m_kBattlePosSolList[j]; if (nkSoldierInfo != null && nkSoldierInfo.IsValid()) { if (nkSoldierInfo.GetBattlePos() >= 0) { if (num2 == nkSoldierInfo.GetBattlePos()) { nkSoldierInfo3 = nkSoldierInfo; } else if (this.nSelectedBattelPos == nkSoldierInfo.GetBattlePos()) { nkSoldierInfo2 = nkSoldierInfo; } } } } if (nkSoldierInfo2 == null && nkSoldierInfo3 == null) { this.nSelectedBattelPos = -1; uIRadioBtn.Value = false; this.BattlePosSelectedPos.Visible = false; return; } if (nkSoldierInfo2 != null) { battlePos = nkSoldierInfo2.GetBattlePos(); nkSoldierInfo2.SetBattlePos(num2); } if (nkSoldierInfo3 != null) { battlePos2 = nkSoldierInfo3.GetBattlePos(); nkSoldierInfo3.SetBattlePos(this.nSelectedBattelPos); } if (!this.IsValidChangeBattlePos()) { if (nkSoldierInfo2 != null) { nkSoldierInfo2.SetBattlePos(battlePos); } if (nkSoldierInfo3 != null) { nkSoldierInfo3.SetBattlePos(battlePos2); } } this.ShowBattlePosInfo(); this.nSelectedBattelPos = -1; uIRadioBtn.Value = false; this.BattlePosSelectedPos.Visible = false; }
private void OnSelectLeft() { UIRadioBtn clickItem = listLeft.LastClickedControl as UIRadioBtn; UIListItemContainer itemContainer = clickItem.transform.parent.gameObject.GetComponent<UIListItemContainer>(); AsChannelListBtn listBtn = itemContainer.gameObject.GetComponent<AsChannelListBtn>(); if( eCONFUSIONTYPE.eCONFUSION_INSPECTION != listBtn.channelData.eConfusion) { AsSoundManager.Instance.PlaySound( "Sound/Interface/S6002_EFF_Button", Vector3.zero, false); if( null != prevSelect) prevSelect.Value = false; clickItem.Value = true; float curClickTime = Time.time; if( 0.4f >= ( curClickTime - prevClickTime) && ( prevSelect == clickItem)) { listBtn.EnterChannel(); } prevSelect = clickItem; prevClickTime = curClickTime; } }