void SetServerBtnStatus(SingleButtonCallBack serverBtn, bool isSelect, ServerStatus serverStatus) { serverBtn.BackgroundSprite.gameObject.SetActive(isSelect); serverBtn.SetButtonBackground((int)serverStatus); serverBtn.textLabel.color = serverStatus == ServerStatus.Maintain ? Color.gray : Color.white; serverBtn.spriteSwithList.ApplyAllItem(P => P.ChangeSprite(serverStatus == ServerStatus.Maintain?2:1)); }
// Use this for initialization void Start() { collider = gameObject.AddComponent <BoxCollider>(); collider.size = new Vector3(110, 110, 1); collider.center = new Vector3(0, 0, -2); buttonCallback = gameObject.AddComponent <SingleButtonCallBack>(); buttonCallback.SetCallBackFuntion(OnItemClick); }
public void Init(SEquipInfo data) { if (ItemBtn == null) { ItemBtn = gameObject.AddComponent <SingleButtonCallBack>(); if (GetComponent <BoxCollider>() == null) { BoxCollider colldider = gameObject.AddComponent <BoxCollider>(); colldider.size = new Vector3(100, 100, 0); } } ItemBtn.SetCallBackFuntion(OnbtnClick); currentDataID = (int)data.dwGoodsID; GoodsIconPoint.ClearChild(); if (data.byStrengLevel > 0) { EqLevel.SetActive(true); EqLevelLable.SetText(data.byStrengLevel); } else { EqLevel.SetActive(false); } if (data.byStartLevel > 0) { StarIcon.gameObject.SetActive(true); StarIcon.ChangeSprite((data.byStartLevel - 1) / 10 + 1); } else { StarIcon.gameObject.SetActive(false); } ItemData itemdata = null; itemdata = ItemDataManager.Instance.GetItemData((int)data.dwGoodsID); if (itemdata != null) { NormalBg.ChangeSprite(itemdata._ColorLevel + 1); GameObject obj = CreatObjectToNGUI.InstantiateObj(itemdata._picPrefab, GoodsIconPoint); if (Background) { Background.SetActive(false); } // obj.name=data.dwGoodsID+"w"; } else { if (Background) { Background.SetActive(true); } EqLevel.SetActive(false); StarIcon.gameObject.SetActive(false); NormalBg.ChangeSprite(5); } }
void SetBtnActive(SingleButtonCallBack btn, bool flag) { btn.SetImageButtonComponentActive(flag); btn.SetButtonColliderActive(flag); Color enableColor = new Color(1, 1, 1, 1); Color disableColor = new Color(1, 1, 1, 0.3f); btn.spriteSwith.target.color = flag?enableColor:disableColor; }
void Awake() { m_callBackComponent = GetComponent <SingleButtonCallBack>(); m_taskTypeIcon = m_callBackComponent.spriteSwithList[0]; //获得任务类型的Sprite切换器 m_taskBg = m_callBackComponent.spriteSwithList[1]; m_callBackComponent.SetCallBackFuntion((obj) => { ItemSelected(); }); }
void Init() { if (isRead) { return; } isRead = true; btnBuy = btnBuyObj.GetComponent <SingleButtonCallBack>(); btnBuy.SetCallBackFuntion(OnClickBuyEvent); }
/// <summary> /// 解锁新武学的时候添加一个武学图标 /// </summary> /// <param name="lineIndex">Line index.</param> /// <param name="index">Index.</param> /// <param name="parent">Parent.</param> public void AddItem(int lineIndex, int index, MartialItemListPanel_V2 parent) { MyParent = parent; GameObject item = NGUITools.AddChild(MartialItemPoint[index].gameObject, MartialItemPrefab); MartialItem martialItem = item.GetComponent <MartialItem>(); SingleButtonCallBack btnCB = item.GetComponent <SingleButtonCallBack>(); btnCB.SetCallBackFuntion(OnSelectItemCallback, ParentItemListPanel.MyMartialDataList[lineIndex * 4 + index].dwWuXueID); martialItem.Init(ParentItemListPanel.MyMartialDataList[lineIndex * 4 + index], ParentItemListPanel.ThisParent.GetComponent <QinglongMartialPanel>().OnItemClick); CurrentShowList.Add(martialItem); }
void ShowCostTipsAndJoin() { int costNumber = int.Parse(LocalEctypeData.lCostEnergy); SingleButtonCallBack Tips = CreatObjectToNGUI.InstantiateObj(CostLabelPreafab, GoButton.transform).GetComponent <SingleButtonCallBack>(); Vector3 fromPoint = new Vector3(0, 50, -30); Vector3 toPoint = new Vector3(0, 0, -30); TweenPosition.Begin(Tips.gameObject, 0.5f, fromPoint, toPoint, SendGoBattleToServer); TweenAlpha.Begin(Tips.gameObject, 0.5f, 1, 0, null); Tips.SetButtonBackground(LocalEctypeData.lCostType); Tips.SetButtonText(string.Format("-{0}", costNumber)); }
void Awake() { CallBackBtn = GetComponentInChildren <SingleButtonCallBack>(); CallBackBtn.SetCallBackFuntion((obj) => { if (CallBackAct != null) { CallBackAct(this); } }); }
/// <summary> /// 在按钮上方显示花费tips /// </summary> void ShowCostLabelInButton() { if (IsShowCostLabel) { return; } EctypeContainerData SelectContainerData = OnSelectEctypeCard.ectypeContainerData; bool isShowCostType = true; int localCostNumber = int.Parse(OnSelectEctypeCard.ectypeContainerData.lCostEnergy); int costNumber = 0; switch (SelectContainerData.lCostType) { case 1: costNumber = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_CURRENCY_ACTIVELIFE; isShowCostType = costNumber > 0 && localCostNumber > 0; break; case 2: costNumber = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY; isShowCostType = costNumber > 0 && localCostNumber > 0; break; case 3: costNumber = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HOLDMONEY; isShowCostType = costNumber > 0 && localCostNumber > 0; break; default: break; } if (isShowCostType) { SingleButtonCallBack Tips = CreatObjectToNGUI.InstantiateObj(CostLabelPreafab, BtnGo.transform).GetComponent <SingleButtonCallBack>(); Vector3 fromPoint = new Vector3(0, 50, -30); Vector3 toPoint = new Vector3(0, 0, -30); TweenPosition.Begin(Tips.gameObject, 0.5f, fromPoint, toPoint, null); TweenAlpha.Begin(Tips.gameObject, 0.5f, 1, 0, null); Tips.SetButtonBackground(OnSelectEctypeCard.ectypeContainerData.lCostType); Tips.SetButtonText(string.Format("-{0}", costNumber > localCostNumber?localCostNumber:costNumber)); } //else //{ // SendGoBattleToServer(null); //} DoForTime.DoFunForTime(1.5f, SendGoBattleToServer, null); SoundManager.Instance.PlaySoundEffect("Sound_Button_Fight"); StartCoroutine(SetShowCostLabelFalseForTime(1.5f)); LoadingUI.Instance.Show(); }
IEnumerator ShowAddAtkAnim(int addNumber) { yield return(null); SingleButtonCallBack creatTitle = CreatObjectToNGUI.InstantiateObj(AddAtkNumberTitle, AtkLabel.transform.parent).GetComponent <SingleButtonCallBack>(); creatTitle.SetButtonText(string.Format("+{0}", addNumber.ToString())); Vector3 toPosition = AtkLabel.transform.localPosition; Vector3 fromPosition = toPosition; fromPosition += new Vector3(0, 0, -10); toPosition += new Vector3(0, 50, -10); TweenPosition.Begin(creatTitle.gameObject, 0.5f, fromPosition, toPosition, DestroyObj); TweenAlpha.Begin(creatTitle.gameObject, 0.5f, 1, 0, null); }
public void ShowCostTips(long costMoney) { if (!IsShow) { return; } SingleButtonCallBack Tips = CreatObjectToNGUI.InstantiateObj(CostTipsPrefab, BuyBtn.transform).GetComponent <SingleButtonCallBack>(); Vector3 fromPoint = new Vector3(0, 50, -30); Vector3 toPoint = new Vector3(0, 0, -30); TweenPosition.Begin(Tips.gameObject, 0.5f, fromPoint, toPoint, null); TweenAlpha.Begin(Tips.gameObject, 0.5f, 1, 0, DestroyObj); Tips.SetButtonBackground(this.SelectGoods.sMsgTradeOpenShopGoodsInfo_SC.bType); Tips.SetButtonText(string.Format("-{0}", costMoney)); }
void Awake() { m_maskWithCollider = CreatObjectToNGUI.InstantiateObj(GuidePicPanel, this.transform).GetComponent <SingleButtonCallBack>(); m_maskWithCollider.SetCallBackFuntion((obj) => { if (m_guidePic != null) { Destroy(m_guidePic); } m_picIndex++; StartPicStep(m_stepItem); }); m_maskWithCollider.SetButtonColliderActive(false); RegisterEventHandler(); }
void UpdateStatus() { if (IsLock) { PackLockCallBack = CreatObjectToNGUI.InstantiateObj(PackLockPrefab, transform).GetComponent <SingleButtonCallBack>(); PackLockCallBack.transform.localScale = new Vector3(1.05f, 0.85f, 1); PackLockCallBack.transform.localPosition = Vector3.zero; PackLockCallBack.SetCallBackFuntion(OnLockBtnClick); // 计算解锁的格数 int UnlockBox = (ContainerInfomanager.Instance.GetContainerClientContsext(2).wMaxSize / 4) - 4; int tackGold = GetActiveEnergyHaveGold(UnlockBox); PackLockCallBack.SetButtonText(tackGold.ToString()); // 引导注入代码 PackLockCallBack.gameObject.RegisterBtnMappingId(UIType.Package, BtnMapId_Sub.Package_PackUnLock); } else { List <ItemFielInfo> allPackItemList = MyParent.MyPackItemList; for (int i = MyIndex * 4, iMax = (MyIndex + 1) * 4; i < iMax; i++) { //ItemFielInfo currentItemFile = allPackItemList.FirstOrDefault(P=>P.sSyncContainerGoods_SC.nPlace == i);//按后台位置排序 ItemFielInfo currentItemFile = allPackItemList.Count > i? allPackItemList[i]: null; ItemFielInfo bestItem = null; EquiptSlotType myItemType = EquiptSlotType.Null; if (currentItemFile != null) { myItemType = getEquiptType(currentItemFile); } MyParent.BestItemList.TryGetValue(myItemType, out bestItem); bool isBestItem = bestItem != null && bestItem == currentItemFile; SinglePackItemSlot newItemSlot = CreatObjectToNGUI.InstantiateObj(SinglePackItemPrefab, transform).GetComponent <SinglePackItemSlot>(); newItemSlot.gameObject.transform.localScale = new Vector3(0.85f, 0.85f, 1); newItemSlot.transform.localPosition = new Vector3(-136 + 90 * (i - MyIndex * 4), 0, 0); newItemSlot.Init(currentItemFile, isBestItem, SinglePackItemSlot.ItemStatus.PackItem, MyParent.MyParent.OnItemClick); m_SingleItemList.Add(newItemSlot); //引导注入 if (currentItemFile != null) { newItemSlot.gameObject.RegisterBtnMappingId(currentItemFile.LocalItemData._goodID, UIType.Package, BtnMapId_Sub.Package_Cell , m_dragAmountSlerpAct, m_dragAmount); } } } }
void InitData() { for (int i = 1; i <= 7; i++) { Transform tran = weekContent.transform.Find(weekStr + i); GameObject goods = NGUITools.AddChild(tran.gameObject, weekDayPrefab); weekList.Add(goods.gameObject.GetComponent <SignWeekInfo>()); } weekDayPrefab.SetActive(false); ConfigDataUpdate(signConfigDataBase); for (int j = 0; j < 3; j++) { rewardList.Add(proReward.transform.Find("Item" + j).GetComponent <SignFruitReward> ()); SingleButtonCallBack btnCB = rewardList[j].gameObject.GetComponent <SingleButtonCallBack>(); //.SetCallBackFuntion();; btnCB.ButtonCallBackInfo = j; btnCB.SetCallBackFuntion(OnClickProgressBtn); } }
/// <summary> /// 显示初始化 /// </summary> /// <param name="lineIndex">Line index.</param> /// <param name="perLineCount">Per line count.</param> /// <param name="parent">Parent.</param> public void Init(int lineIndex, int perLineCount, MartialItemListPanel_V2 parent) { MyParent = parent; ParentItemListPanel = parent.GetComponent <MartialItemListPanel_V2>(); //LineIndex = lineIndex; for (int i = 0; i < perLineCount; i++) { GameObject item = NGUITools.AddChild(MartialItemPoint[i].gameObject, MartialItemPrefab); MartialItem martialItem = item.GetComponent <MartialItem>(); SingleButtonCallBack btnCB = item.GetComponent <SingleButtonCallBack>(); btnCB.SetCallBackFuntion(OnSelectItemCallback, parent.MyMartialDataList[lineIndex * 4 + i].dwWuXueID); martialItem.Init(parent.MyMartialDataList[lineIndex * 4 + i], parent.ThisParent.GetComponent <QinglongMartialPanel>().OnItemClick); CurrentShowList.Add(martialItem); if (lineIndex * 4 + i == 0) { ParentItemListPanel.ThisParent.GetComponent <QinglongMartialPanel>().OnItemClick(martialItem.MartialID); } } }
void Init() { if (isRead) { return; } isRead = true; skillItemPrefab.SetActive(true); int Count = SkillModel.Instance.skillMap [curTreeID].Count; for (int i = 0; i < Count; i++) { int index = (i == 0?0:(Count == 2?2:i)); Transform parentPoint = parentPointList[index].transform; GameObject item = NGUITools.AddChild(parentPoint.gameObject, skillItemPrefab);//CreatObjectToNGUI.InstantiateObj(skillItemPrefab,parentPoint); SkillUpgradeIconItem scrItem = item.GetComponent <SkillUpgradeIconItem>(); SingleButtonCallBack btnCB = item.GetComponent <SingleButtonCallBack>(); btnCB.SetCallBackFuntion(OnClickSkillItemEvent, i); btnCB.gameObject.RegisterBtnMappingId(SkillModel.Instance.skillMap [curTreeID][i], UIType.Skill, BtnMapId_Sub.Skill_UpgrdeListItem); skillList.Add(scrItem); } skillItemPrefab.SetActive(false); swithBg.ChangeSprite((curTreeID % 2) == 0?2:1); }
void RecoverButton(SingleButtonCallBack button) { button.SetImageButtonComponentActive(true); button.SetTextColor(Color.white); button.SetButtonBackground(1); }
void SetButtonActive(SingleButtonCallBack button, bool Flag) { button.BackgroundSprite.alpha = Flag ? 1 : 0.5f; button.collider.enabled = Flag; }
void SetButtonActive(SingleButtonCallBack button, bool Flag) { button.SetImageButtonComponentActive(Flag); button.SetButtonBackground(Flag?1:2); button.collider.enabled = Flag; }
void ShowVipAddExpEffect(object obj) { SingleButtonCallBack vipGetExpTips = VipExpEffectPoint.InstantiateNGUIObj(VipExpTipsPrefab).GetComponent <SingleButtonCallBack>(); vipGetExpTips.SetButtonText(string.Format(LanguageTextManager.GetString("IDS_I21_8"), PlayerDataManager.Instance.GetEctypeExpBonus())); }
void GrayButton(SingleButtonCallBack button) { button.SetImageButtonComponentActive(false); button.SetTextColor(Color.gray); button.SetButtonBackground(2); }
void Awake() { m_callBack = GetComponent <SingleButtonCallBack>(); }