public CommonBtnInfo(int btnPosition, string normalSprite, string pressedSprite, ButtonCallBack onClickCallBack) { this.BtnPosition = btnPosition; this.BtnNormalSprite = normalSprite; this.BtnPressedSprite = pressedSprite; this.OnClickCallBack = onClickCallBack; }
public Textbox(Vector2 pos, SpriteBatch sb, ButtonCallBack onSubmit) : base(sb) { this.onSubmit = onSubmit; this.pos = pos; for (int row = 0; row < keys.GetLength(0); row++) { for (int key = 0; key < keys.GetLength(1); key++) { buttons.Add(new Button(new Vector2(pos.X + key * xSpacing, pos.Y + (row + 1) * ySpacing), new Vector2(xSpacing, ySpacing), sb, Pressed, keys[row, key].ToString(), 0, Button.Align.center) { background = Color.Gray }); } } foreach (var b in buttons) { switch (b.text) { case "OK": b.textColor = Color.Green; break; case "<": b.textColor = Color.Red; break; } } }
public void Init(ButtonCallBack SelectCallBack, ButtonCallBack CanelSelectCallBack, bool CanCanel, bool ShowFlag) { m_Selcetcallback = SelectCallBack; m_CanelSelcetcallback = CanelSelectCallBack; m_canCanel = CanCanel; m_ShowFlag = ShowFlag; UpdateFlag(ShowFlag); }
public void ShowPanel(string Msg, int Type, int PayNumber, ButtonCallBack SureBtnCallBack) { Show(); MsgTitle.SetText(Msg); IconBtn.SetButtonBackground(Type - 1); IconBtn.SetButtonText(PayNumber.ToString()); this.SureBtnCallBack = SureBtnCallBack; }
public void Init(ItemFielInfo itemFileInfo, ButtonCallBack clickCallBack) { base.Init(itemFileInfo, false, ItemStatus.Sell, clickCallBack); bool isEquipt = ContainerInfomanager.Instance.IsItemEquipped(itemFileInfo); EquiptItemIcon.gameObject.SetActive(isEquipt); //引导注入 gameObject.RegisterBtnMappingId(itemFileInfo.LocalItemData._goodID, UIType.Package, BtnMapId_Sub.Package_EquipmentUpgradePanel_UpgradeItem); }
public static void StartFloatNumAnim(float Time, float FromeNum, float ToNum, ButtonCallBack finishCallBack) { GameObject FloatAnimObj = new GameObject(); AddNumberAnim addNumScripit = FloatAnimObj.AddComponent <AddNumberAnim>(); addNumScripit.AddTime = Time; addNumScripit.FromeNumber = FromeNum; addNumScripit.ToNumber = ToNum; addNumScripit.FinishCallBack = finishCallBack; }
public void Show(string ShowInfo, ButtonCallBack CallBackFuntion, float TipsTime) { this.TitleAnimTime = TipsTime; this.CompleteCallBack = CallBackFuntion; TipsLabel.text = ShowInfo; //Color tipsColor = Color.white; //tipsColor.a = 1; //TweenColor.Begin(gameObject, 0.2f, tipsColor); TweenAlpha.Begin(gameObject, 0.2f, 1); TweenPosition.Begin(gameObject, TitleAnimTime, transform.localPosition, transform.localPosition += new Vector3(0, 50, 0)); StartCoroutine(TransparentMySelf()); }
public Button(Vector2 pos, Vector2 size, SpriteBatch sb, ButtonCallBack onClicked, string text, int index = 0, Align align = Align.left, string font = "DefaultFont") : base(sb) { textColor = new Color(100, 100, 100); this.font = font; this.align = align; this.onClicked = onClicked; this.pos = pos - size / 2; this.size = size; this.sb = sb; this.text = text; this.index = index; }
public void Init(ItemFielInfo myItemFileInfo, bool isBestItem, ItemStatus itemStatus, ButtonCallBack clickCallBack) { this.MyItemFileInfo = myItemFileInfo; this.MyItemStatus = itemStatus; this.ClickCallBack = clickCallBack; EmptyMySelf(); if (myItemFileInfo != null) { BestIcon.gameObject.SetActive(itemStatus == ItemStatus.PackItem && isBestItem); UpdateStatu(); } }
public Button(int x, int y, int sx, int sy, string str, int mode, ButtonCallBack Down=null, ButtonCallBack Up = null) { this.rect = new Rectangle(x, y, sx, sy); this.name = str; this.key = -1; this.mode = mode; NameRect = NameSize(name); this.NamePos = new Point(); NamePos.X = x + (int)(float)(sx / 2 - NameRect.Width / 2); NamePos.Y = y + (int)(float)(sy / 2 - NameRect.Height / 2); ButtonDown = Down; ButtonUp = Up; }
public void Show(CostMoneyType CostMoneyType, int CostMoneyNumber, string Msg, string SureBtnStr, string CancelBtnStr, ButtonCallBack SureBtnCallBack, ButtonCallBack CancelBtnCallBack) { transform.localPosition = new Vector3(0, 0, -100); this.MsgLabel.SetText(Msg); CostTypeIcon.ChangeSprite((int)CostMoneyType); CostNumberLabel.SetText(CostMoneyNumber); SureBtn.SetCallBackFuntion(OnSureBtnClick); CancelBtn.SetCallBackFuntion(OnCancelBtnClick); SureBtnLabel.SetText(SureBtnStr); CancelBtnLabel.SetText(CancelBtnStr); this.SureCallBack = SureBtnCallBack; this.CancelCallBack = CancelBtnCallBack; }
public IEnumerator RequestPropagandaList(ButtonCallBack callBack) { WWW www = new WWW("http://jh.fanhougame.net/gm/?from=front&service=GameManagerService&action=getAutoTalkInfo"); yield return(www); if (www.isDone && string.IsNullOrEmpty(www.error)) { PhpAutoPropaganda phpPropaganda = JsonConvertor <PhpAutoPropaganda> .Json2Object(www.text); callBack(phpPropaganda); } }
//Add By Jiang public static TweenPosition Begin(GameObject go, float duration, Vector3 fromPos,Vector3 toPos,ButtonCallBack finishCallBack) { TweenPosition comp = UITweener.Begin<TweenPosition>(go, duration); comp.from = fromPos; comp.to = toPos; comp.FinishCallBack = finishCallBack; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return comp; }
public void Show(string Message, ButtonCallBack SureBtnCallBack, ButtonCallBack CancelBtnCallBack, string sureBtnStr, string cancelBtnStr) { this.MsgLabel.SetText(Message); this.SureBtn.SetButtonText(sureBtnStr); this.CancelBtn.SetButtonText(cancelBtnStr); this.CancelBtnCallBack = CancelBtnCallBack; transform.localPosition = new Vector3(0, 0, -100); int UnlockBox = (ContainerInfomanager.Instance.GetContainerClientContsext(2).wMaxSize / 4) - 4; int tackGold = GetActiveEnergyHaveGold(UnlockBox); bool canBuy = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY >= tackGold; TakeMoneyLabel.SetText(NGUIColor.SetTxtColor(tackGold.ToString(), canBuy?TextColor.white:TextColor.red)); this.SureBtnCallback = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY >= tackGold?SureBtnCallBack:ShowNoMoneyTips; }
/// <summary> /// 显示花费提示信息 /// </summary> void ShowCostMessageBox(ButtonCallBack SureBtnCallback) { EctypeContainerData SelectContainerData = OnSelectEctypeCard.ectypeContainerData; int Cost = int.Parse(SelectContainerData.lCostEnergy); if (SelectContainerData.lCostType != 1) { ectypePanelMessageBox.ShowPanel(LanguageTextManager.GetString("IDS_H1_319"), SelectContainerData.lCostType, Cost, SureBtnCallback); } else { SureBtnCallback(null); } }
public void BeginFlag(int flagTime, Color FlagColor1, Color FlagColor2, ButtonCallBack CompleteCallBack) { if (FlagNow || !gameObject.active) { return; } FlagNow = true; this.FlagTime = flagTime * 2; this.FlagColor1 = FlagColor1; this.FlagColor2 = FlagColor2; this.CompleteCallBack = CompleteCallBack; CurrentFlagTime = 0; TweenColor.Begin(gameObject, FlagSpeed, FlagColor1, FlagColor2); StartCoroutine(ChangeColor(FlagColor2)); }
/// <summary> /// 新增回调 /// </summary> /// <param name="go"></param> /// <param name="duration"></param> /// <param name="rot"></param> /// <returns></returns> static public TweenRotation Begin(GameObject go, float duration, Quaternion rot, ButtonCallBack CallBack) { TweenRotation comp = UITweener.Begin <TweenRotation>(go, duration); comp.from = comp.rotation.eulerAngles; comp.to = rot.eulerAngles; comp.CallBackWhenFinished = CallBack; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }
public static TweenAlpha Begin(GameObject go, float duration, float falphaf, float toAlpha, ButtonCallBack finishCallBack) { TweenAlpha comp = UITweener.Begin<TweenAlpha>(go, duration); comp.from = falphaf; comp.to = toAlpha; comp.FinishCallBack = finishCallBack; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; finishCallBack(comp); } return comp; }
/// <summary> /// 初始化 /// </summary> /// <param name="SendWuXueData">Send wu xue data.</param> /// <param name="Callback">Callback.</param> public void Init(SSendWuXueData SendWuXueData, ButtonCallBack Callback) { MartialIndex martialIndex = new MartialIndex() { MartialArtsID = SendWuXueData.dwWuXueID, MartialArtsLevel = SendWuXueData.byWuXueLevel }; PlayerMartialData = PlayerDataManager.Instance.GetPlayerMartialArtConfigData(martialIndex); MartialId = SendWuXueData.dwWuXueID; GameObject Icon = UI.CreatObjectToNGUI.InstantiateObj(PlayerMartialData.MartialArtsIconPrefab, IconPoint); this.gameObject.GetComponent <SingleButtonCallBack>().SetCallBackFuntion(Callback, MartialId); UpdateIconBg(SendWuXueData.byWuXueLevel); UpdateLevel(SendWuXueData.dwWuXueID); UpdateArrow(); }
public void Show(int sirenID, int price, ButtonCallBack unlockCallBack) { Label_Title.text = LanguageTextManager.GetString("IDS_I2_6"); this.m_SirenID = sirenID; this.m_SirenPrice = price; this.m_SirenUnlockCallBack = unlockCallBack; Label_Value.text = price.ToString(); transform.localPosition = Vector3.zero; if (m_SirenPrice > PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY) { Label_Value.color = Color.red; } else { Label_Value.color = new Color(1f, 0.98f, 0.435f); } }
void OnchessTouched(ButtonCallBack bcb, ButtonCallBack.Trigger trigger) { //print(bcb.id1 + ", " + bcb.id2 + " : " + trigger.ToString()); coordinate co = new coordinate(bcb.id1, bcb.id2); if (trigger == ButtonCallBack.Trigger.OnPress) { currentMoving = co; if (playHistory != null) { playHistory.Clear(); playHistory = null; } playHistory = new List <coordinate>(); playHistory.Add(co); if (OnPress != null) { OnPress(co, chess); } StartCoroutine(PressCountDown(2.0f)); } else if (trigger == ButtonCallBack.Trigger.OnRelease) { if (currentMoving != null) { setPositionByID(currentMoving); if (OnMoveFinish != null) { OnMoveFinish(chess, playHistory); } currentMoving = null; } } }
static public TweenPosition Begin(GameObject go, float duration, Vector3 From, Vector3 pos, ButtonCallBack CallBack) { TweenPosition comp = UITweener.Begin <TweenPosition>(go, duration); comp.CallBackWhenFinished = CallBack; comp.from = From; comp.to = pos; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; CallBack(comp.gameObject); } return(comp); }
/// <summary> /// 当快速加入的时候检查背包 /// </summary> // public void CheckQuickJionBackpack() // { // SoundManager.Instance.PlaySoundEffect("Sound_Button_Default"); // ushort maxNum = ContainerInfomanager.Instance.GetContainerClientContsext(2).wMaxSize; // var backpack = ContainerInfomanager.Instance.GetSSyncContainerGoods_SCList(2).Where(p => p.uidGoods != 0).ToList(); // if (maxNum - backpack.Count < 2) // { // MessageBox.Instance.Show(4, "", LanguageTextManager.GetString("IDS_H1_201"), LanguageTextManager.GetString("IDS_H2_55"), LanguageTextManager.GetString("IDS_H2_28"), SendGoBattleToServer, null); // } // else // { // CheckGotoBattle(SendGoBattleToServer); // } // } /// <summary> /// 检测是否足够资源加入副本 /// </summary> bool CheckGotoBattle(ButtonCallBack SureBtnCallback) { bool Flag = true; EctypeContainerData SelectContainerData = CurrentSelectEctypeContaienrData; switch (SelectContainerData.lCostType) { case 1: int Cost = int.Parse(SelectContainerData.lCostEnergy); int PayMoney = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CURRENCY_ACTIVELIFE; if (PayMoney >= Cost) { JudgeAndExitTeam(); if (SureBtnCallback != null) { SureBtnCallback(null); } } else { //UIEventManager.Instance.TriggerUIEvent(UIEventType.NoEnoughActiveLife, null); PopupObjManager.Instance.ShowAddVigour(); } break; case 2: Cost = int.Parse(SelectContainerData.lCostEnergy); PayMoney = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY; if (PayMoney < Cost) { //MessageBox.Instance.Show(3, "", LanguageTextManager.GetString("IDS_H2_44"), LanguageTextManager.GetString("IDS_H2_55"), null); MessageBox.Instance.ShowTips(3, LanguageTextManager.GetString("IDS_H2_44"), 1); Flag = false; } else { JudgeAndExitTeam(); if (SureBtnCallback != null) { SureBtnCallback(null); } } break; case 3: int CostGold = int.Parse(SelectContainerData.lCostEnergy); int BINDPAY = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HOLDMONEY; if (BINDPAY < CostGold) { //MessageBox.Instance.Show(3, "", LanguageTextManager.GetString("IDS_H1_231"), LanguageTextManager.GetString("IDS_H2_55"), null); MessageBox.Instance.ShowTips(3, LanguageTextManager.GetString("IDS_H1_231"), 1); Flag = false; } else { JudgeAndExitTeam(); if (SureBtnCallback != null) { SureBtnCallback(null); } } break; default: break; } return(Flag); }
public GameObject createButton ( string name, float x, float z, float y, Vector3 scale, Texture2D texture, Texture2D textureDown, ButtonCallBack callBack, GameObject attachToGameObject = null, bool destroyOnClick = true ) { GameObject buttonInstant = ( GameObject ) Instantiate ( _buttonPrefab, Vector3.zero, _buttonPrefab.transform.rotation ); buttonInstant.name = name; if ( attachToGameObject == null ) buttonInstant.transform.parent = Camera.main.transform; else buttonInstant.transform.parent = attachToGameObject.transform; buttonInstant.transform.localPosition = new Vector3 ( x, z, y ); if ( texture == null ) { buttonInstant.renderer.material = transparentMaterial; } else { buttonInstant.renderer.material.mainTexture = texture; } buttonInstant.transform.localScale = scale; ButtonManager currentButtonManager = buttonInstant.AddComponent < ButtonManager > (); currentButtonManager.myCallBack = callBack; currentButtonManager.destroyOnClick = destroyOnClick; OnMouseDownButtonEffectControl currentOnMouseDownButtonEffectControl = buttonInstant.AddComponent < OnMouseDownButtonEffectControl > (); currentOnMouseDownButtonEffectControl.myOnMouseUpTexture = texture; currentOnMouseDownButtonEffectControl.myOnMouseDownTexture = textureDown; return buttonInstant; }
/// <summary> /// 新增回调 江志祥 /// </summary> /// <param name="go"></param> /// <param name="duration"></param> /// <param name="alpha"></param> /// <returns></returns> static public TweenAlpha Begin(GameObject go, float duration, float Fromalpha, float Toalpha, ButtonCallBack CallBack) { TweenAlpha comp = UITweener.Begin <TweenAlpha>(go, duration); comp.from = Fromalpha; comp.to = Toalpha; comp.CallBackWhenFinished = CallBack; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }
public void SetCallBackFuntion(ButtonCallBack btnCB) { this.BtnCallBack = new ButtonCallBack(btnCB); }
public void SetCallBackFuntion(ButtonCallBack buttonCallBack) { this.buttonCallback = buttonCallBack; }
public abstract void SetCallBackFuntion(ButtonCallBack ButtonCallBack, object obj);
//public UISprite IconSprite;//切换显示ICON的sprite public override void SetCallBackFuntion(ButtonCallBack ButtonCallBack, object obj) { this.buttonCallback = ButtonCallBack; base.ButtonCallBackInfo = obj; }
public static GameObject Begin(float Duration, float fromValue, float ToValue, ChangeValueDelegate changeValueDelegate, ButtonCallBack FinishCallBack) { if (Duration == 0) { fromValue = ToValue; } if (fromValue == ToValue) { if (FinishCallBack != null) { FinishCallBack(null); } if (changeValueDelegate != null) { changeValueDelegate(ToValue); } return(null); } GameObject TweenObj = new GameObject(); TweenObj.AddComponent <TweenFloat>(); TweenObj.name = "TweenFloatObj"; TweenFloat tweenFloat = TweenObj.GetComponent <TweenFloat>(); tweenFloat.AddNumber = (ToValue - fromValue) / Duration; tweenFloat.FromValue = fromValue; tweenFloat.ToValue = ToValue; tweenFloat.changeValueDelegate = changeValueDelegate; tweenFloat.FinishCallBack = FinishCallBack; if (fromValue < ToValue) { tweenFloat.IsAdd = true; } else { tweenFloat.IsAdd = false; } return(TweenObj); }
public void SetCallBack(ButtonCallBack callBack) { m_CallBack = callBack; }
public CommonBtnInfo(ButtonCallBack onClickCallBack) { this.OnClickCallBack = onClickCallBack; }
public void ChangeButtonInfo(CommonBtnInfo commonBtnInfo, string normalSprite, string pressedSprite, ButtonCallBack onClickCallBack) { if (m_btnList.ContainsKey(commonBtnInfo)) { m_btnList[commonBtnInfo].commonBtnInfo.OnClickCallBack = onClickCallBack; m_btnList[commonBtnInfo].SetBackgroundSprite(normalSprite); m_btnList[commonBtnInfo].SetClickSprite(pressedSprite); } }
/// <summary> /// 新增回调 /// </summary> /// <param name="go"></param> /// <param name="duration"></param> /// <param name="scale"></param> /// <returns></returns> static public TweenScale Begin(GameObject go, float duration, Vector3 FromScale, Vector3 ToScale, ButtonCallBack CallBack) { TweenScale comp = UITweener.Begin <TweenScale>(go, duration); comp.from = FromScale; comp.to = ToScale; comp.CallBackWhenFinished = CallBack; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }