void InitProperty() { iconname_sprite = transform.Find("icon_name").GetComponent<UISprite>(); name_label = transform.Find("property/name").GetComponent<UILabel>(); applytype_label = transform.Find("property/applytype").GetComponent<UILabel>(); des_label = transform.Find("property/des").GetComponent<UILabel>(); mp_label = transform.Find("property/MP").GetComponent<UILabel>(); }
public void Init(MonsterInfo info, bool showTips) { if (info == null) { base.gameObject.SetActive(false); return; } this.mShowTips = showTips; this.icon = base.transform.FindChild("icon").GetComponent<UISprite>(); if (showTips) { if (this.icon.collider != null) { this.icon.collider.enabled = true; } UIEventListener expr_72 = UIEventListener.Get(this.icon.gameObject); expr_72.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(expr_72.onPress, new UIEventListener.BoolDelegate(this.OnEnemyItemPress)); } else if (this.icon.collider != null) { this.icon.collider.enabled = false; } this.propertyBg = base.transform.GetComponent<UISprite>(); this.Refresh(info); }
private void CreateObjects() { Transform transform = base.transform.Find("personInfoLayer"); this.mNameLabel = transform.Find("name").GetComponent<UILabel>(); this.mGuildNameLabel = transform.Find("guildName").GetComponent<UILabel>(); Transform transform2 = transform.Find("bg"); this.mIcon = transform2.Find("icon").GetComponent<UISprite>(); this.mQualityMask = transform2.Find("Frame").GetComponent<UISprite>(); GameObject gameObject = transform.Find("closeBtn").gameObject; UIEventListener expr_8C = UIEventListener.Get(gameObject); expr_8C.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_8C.onClick, new UIEventListener.VoidDelegate(this.OnCloseBtnClick)); GameObject gameObject2 = transform.Find("chatBtn").gameObject; UIEventListener expr_C4 = UIEventListener.Get(gameObject2); expr_C4.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_C4.onClick, new UIEventListener.VoidDelegate(this.OnChatClick)); GameObject gameObject3 = transform.Find("viewBtn").gameObject; UIEventListener expr_FE = UIEventListener.Get(gameObject3); expr_FE.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_FE.onClick, new UIEventListener.VoidDelegate(this.OnViewClick)); GameObject gameObject4 = transform.Find("friendBtn").gameObject; UIEventListener expr_138 = UIEventListener.Get(gameObject4); expr_138.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_138.onClick, new UIEventListener.VoidDelegate(this.OnFriendClick)); this.mFriendLabel = gameObject4.transform.Find("Label").GetComponent<UILabel>(); GameObject gameObject5 = transform.Find("backlistBtn").gameObject; UIEventListener expr_18E = UIEventListener.Get(gameObject5); expr_18E.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_18E.onClick, new UIEventListener.VoidDelegate(this.OnBacklistClick)); this.mBacklistLabel = gameObject5.transform.Find("Label").GetComponent<UILabel>(); }
public override void OnCreate() { base.OnCreate(); for (int i = 0; i < 3; ++i ) { m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1)); //查找sprite } m_progressSprite = GetChildComponent<UISprite>("Progress"); //查找sprite stageBoard = GetChildComponent<UISprite>("StageBoard"); m_speedSlider = GetChildComponent<UISlider>("SpeedSlider"); m_speedLabel = GetChildComponent<UILabel>("SpeedLabel"); m_timeBar = GetChildComponent<UISprite>("TimeBar"); m_scoreDrawer = GetChildComponent<NumberDrawer>("ScoreDrawer"); m_stepDrawer = GetChildComponent<NumberDrawer>("StepDrawer"); m_timeNumber = UIToolkits.FindChild(mUIObject.transform, "TimeNumber").gameObject; m_minNumber = GetChildComponent<NumberDrawer>("MinNumber"); m_secNumber = GetChildComponent<NumberDrawer>("SecNumber"); }
public override void OnCreate() { base.OnCreate(); m_collectBoard = mUIObject.transform.FindChild("CollectBoard"); m_jellyBoard = mUIObject.transform.FindChild("JellyBoard"); m_scoreBoard = mUIObject.transform.FindChild("ScoreBoard"); m_nutBoard = mUIObject.transform.FindChild("NutBoard"); m_gameFailedBoard = mUIObject.transform.FindChild("FailedBoard"); m_resortBoard = mUIObject.transform.FindChild("ResortBoard"); m_autoResortBoard = mUIObject.transform.FindChild("AutoResortBoard"); m_sugarCrushBoard = mUIObject.transform.FindChild("SugarCrushBoard"); m_stepLimitBoard = mUIObject.transform.FindChild("StepLimitBoard"); m_timeLimitBoard = mUIObject.transform.FindChild("TimeLimitBoard"); nut1Label = GetChildComponent<NumberDrawer>("NutCount1"); nut2Label = GetChildComponent<NumberDrawer>("NutCount2"); nut1Icon = GetChildComponent<UISprite>("NutIcon1"); nut2Icon = GetChildComponent<UISprite>("NutIcon2"); nutSplash = GetChildComponent<UISprite>("NutSplash"); jellyIcon = GetChildComponent<UISprite>("SingleIcon"); jellyDoubleIcon = GetChildComponent<UISprite>("DoubleIcon"); jellySplash = GetChildComponent<UISprite>("JellySlash"); m_background = GetChildComponent<UISprite>("Background"); for (int i = 0; i < 3; ++i ) { collectLabel[i] = GetChildComponent<UILabel>("CollectCount" + (i + 1)); collectIcon[i] = GetChildComponent<UISprite>("Icon" + (i + 1)); } }
void Awake() { m_instance = this; m_myTransform = transform; FillFullNameData(m_myTransform); m_goOccupyTowerPassUIPlayer = FindTransform("OccupyTowerPassUIPlayer").gameObject; m_goOccupyTowerPassUIPlayer.SetActive(false); m_listPlayerInfoPos.Clear(); for (int i = 1; i <= MAX_PLAYER_COUNT; i++) { GameObject goPlayerPos = FindTransform(string.Format("OccupyTowerPassUIPlayerPos{0}", i)).gameObject; m_listPlayerInfoPos.Add(goPlayerPos); } AddPlayerInfoList(MAX_PLAYER_COUNT, () => { SetPlayerInfoListData(m_listPlayerInfoData); }); m_spOccupyTowerPassUITitle = FindTransform("OccupyTowerPassUITitle").GetComponentsInChildren<UISprite>(true)[0]; m_lblOccupyTowerPassUICountDown = FindTransform("OccupyTowerPassUICountDown").GetComponentsInChildren<UILabel>(true)[0]; m_goOccupyTowerPassUIResult = FindTransform("OccupyTowerPassUIResult").gameObject; m_lblOccupyTowerPassUIResultText = FindTransform("OccupyTowerPassUIResultText").GetComponentsInChildren<UILabel>(true)[0]; m_goOccupyTowerPassUIReward = FindTransform("OccupyTowerPassUIReward").gameObject; m_lblOccupyTowerPassUIRewardText = FindTransform("OccupyTowerPassUIRewardText").GetComponentsInChildren<UILabel>(true)[0]; m_lblOccupyTowerPassUIPlayerTitleRank = FindTransform("OccupyTowerPassUIPlayerTitleRank").GetComponentsInChildren<UILabel>(true)[0]; m_lblOccupyTowerPassUIPlayerTitleAddition = FindTransform("OccupyTowerPassUIPlayerTitleAddition").GetComponentsInChildren<UILabel>(true)[0]; Initialize(); }
void Awake() { if (!buttonSprite) { buttonSprite = gameObject.GetComponent<UISprite>(); } }
public virtual void OnEnable() { if (this._action != InputMappingIcons.Actions.None) { this.FillSprite = ActionIconSystem.RegisterIcon(base.transform, this._action, ActionIconSystem.CurrentViewOptions.AllowInWorld); } }
// Use this for initialization void Start () { addTime = 1.0f; timer = 0.0f; sprite = this.GetComponent<UISprite>(); }
void Start() { m_sprite = GetComponent<UISprite>(); Vector3 size = new Vector3(Screen.width, Screen.height, 1); m_sprite.SetDimensions((int)size.x, (int)size.y); }
/// <summary> /// Show the selection wizard. /// </summary> public static void Show (UIAtlas atlas, UISprite selectedSprite) { SpriteSelector comp = ScriptableWizard.DisplayWizard<SpriteSelector>("Select a Sprite"); comp.mAtlas = atlas; comp.mSprite = selectedSprite; comp.mCallback = null; }
private void CreateObjects() { this.mIcon = base.transform.Find("icon").GetComponent<UISprite>(); this.mQualityMask = base.transform.Find("qualityMark").GetComponent<UISprite>(); this.mNum = base.transform.Find("num").GetComponent<UILabel>(); this.mName = base.transform.Find("name").GetComponent<UILabel>(); }
public override void OnInspectorGUI () { EditorGUIUtility.LookLikeControls(80f); mButton = target as UIImageButton; mSprite = EditorGUILayout.ObjectField("Sprite", mButton.target, typeof(UISprite), true) as UISprite; if (mButton.target != mSprite) { NGUIEditorTools.RegisterUndo("Image Button Change", mButton); mButton.target = mSprite; if (mSprite != null) mSprite.spriteName = mButton.normalSprite; } if (mSprite != null) { ComponentSelector.Draw<UIAtlas>(mSprite.atlas, OnSelectAtlas); if (mSprite.atlas != null) { NGUIEditorTools.SpriteField("Normal", mSprite.atlas, mButton.normalSprite, OnNormal); NGUIEditorTools.SpriteField("Hover", mSprite.atlas, mButton.hoverSprite, OnHover); NGUIEditorTools.SpriteField("Pressed", mSprite.atlas, mButton.pressedSprite, OnPressed); } } }
public void Init() { this.mReward = base.transform.Find("Reward"); this.mTitle = base.transform.Find("title").GetComponent<UILabel>(); this.mCurrencyIcon = base.transform.Find("currencyIcon"); this.mPrice = this.mCurrencyIcon.transform.Find("price").GetComponent<UILabel>(); this.mCanUsed = this.mCurrencyIcon.transform.Find("canUsed").GetComponent<UILabel>(); this.mTip = base.transform.Find("tips").GetComponent<UILabel>(); this.mStep = base.transform.Find("step").GetComponent<UILabel>(); this.Slider = base.transform.Find("slider").gameObject; this.mSF = this.Slider.transform.Find("Fg").GetComponent<UISprite>(); for (int i = 0; i < 5; i++) { this.discount[i] = this.Slider.transform.Find(string.Format("p{0}", i)).GetComponent<UILabel>(); this.buyCount[i] = this.discount[i].transform.Find("num").GetComponent<UILabel>(); this.discount[i].text = "0"; } this.buyCount[0].text = string.Empty; this.mBtnBuy = base.transform.Find("GoBtn").gameObject; UIEventListener expr_1A5 = UIEventListener.Get(this.mBtnBuy); expr_1A5.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(expr_1A5.onClick, new UIEventListener.VoidDelegate(this.OnBtnBuyClicked)); this.mBtnOver = base.transform.Find("OverBtn").gameObject; ActivitySubSystem expr_1F0 = Globals.Instance.Player.ActivitySystem; expr_1F0.GBBuyItemEvent = (ActivitySubSystem.AGBCallBack)Delegate.Combine(expr_1F0.GBBuyItemEvent, new ActivitySubSystem.AGBCallBack(this.OnActivityGroupBuyingBuyEvent)); ActivitySubSystem expr_220 = Globals.Instance.Player.ActivitySystem; expr_220.GetGroupBuyingDataEvent = (ActivitySubSystem.VoidCallback)Delegate.Combine(expr_220.GetGroupBuyingDataEvent, new ActivitySubSystem.VoidCallback(this.OnGetActivityGBEvent)); }
public void LoadResourceInsteadOfAwake() { if (m_bLoadResourceInsteadOfAwake) return; m_bLoadResourceInsteadOfAwake = true; m_myTransform = transform; FillFullNameData(m_myTransform); m_spCurrentEquipImg = m_myTransform.FindChild(m_widgetToFullName["CurrentEquipImg"]).GetComponentsInChildren<UISprite>(true)[0]; m_spCurrentEquipImgBG = m_myTransform.FindChild(m_widgetToFullName["CurrentEquipImgBG"]).GetComponentsInChildren<UISprite>(true)[0]; m_lblCurrentEquipText = m_myTransform.FindChild(m_widgetToFullName["CurrentEquipText"]).GetComponentsInChildren<UILabel>(true)[0]; m_lblCurrentEquipScoreText = FindTransform("CurrentEquipScoreText").GetComponentsInChildren<UILabel>(true)[0]; m_goCurrentEquipButton = FindTransform("CurrentEquipButton").gameObject; m_spRecommendEquipImg = m_myTransform.FindChild(m_widgetToFullName["RecommendEquipImg"]).GetComponentsInChildren<UISprite>(true)[0]; m_spRecommendEquipImgBG = m_myTransform.FindChild(m_widgetToFullName["RecommendEquipImgBG"]).GetComponentsInChildren<UISprite>(true)[0]; m_lblRecommendEquipText = m_myTransform.FindChild(m_widgetToFullName["RecommendEquipText"]).GetComponentsInChildren<UILabel>(true)[0]; m_lblRecommendEquipScoreText = FindTransform("RecommendEquipScoreText").GetComponentsInChildren<UILabel>(true)[0]; m_goRecommendEquipButton = FindTransform("RecommendEquipButton").gameObject; m_lblScoreUpgradeNum = m_myTransform.FindChild(m_widgetToFullName["ScoreUpgradeNum"]).GetComponentsInChildren<UILabel>(true)[0]; m_goLinkBtn = m_myTransform.FindChild(m_widgetToFullName["LinkBtn"]).gameObject; m_lblLinkBtnText = m_myTransform.FindChild(m_widgetToFullName["LinkBtnText"]).GetComponentsInChildren<UILabel>(true)[0]; linkButton = m_myTransform.FindChild(m_widgetToFullName["LinkBtn"]).gameObject.AddComponent<EquipRecommendUIGridButton>(); }
public override void Awake() { base.Awake(); _UiSpriteReceiver = GetComponent<UISprite>(); _uiImage = GetComponent<UnityEngine.UI.Image>(); }
private void CreateObjects() { this.backMenu = base.RegisterClickEvent("backMenu", new UIEventListener.VoidDelegate(this.OnReturnClick), base.gameObject); this.backMenu.gameObject.SetActive(false); this.result = base.transform.Find("result").GetComponent<UISprite>(); this.result.gameObject.SetActive(true); this.result.spriteName = ((!GUIPillageResultScene.PillageResultWin) ? "Failure" : "Victory_Txt"); GameObject gameObject = GameUITools.FindGameObject("infoBg", base.gameObject); this.time = gameObject.transform.FindChild("time").gameObject; this.time.SetActive(false); this.gold = gameObject.transform.FindChild("gold").gameObject; this.gold.SetActive(false); this.exp = gameObject.transform.FindChild("exp").gameObject; this.exp.SetActive(false); this.timeLabel = this.time.transform.Find("num").GetComponent<UILabel>(); this.goldLabel = this.gold.transform.Find("num").GetComponent<UILabel>(); this.expLabel = this.exp.transform.Find("num").GetComponent<UILabel>(); GameObject gameObject2 = gameObject.transform.FindChild("Level").gameObject; this.levelAnimation = gameObject2.AddComponent<GUILevelExpUpAnimation>(); gameObject2.SetActive(false); this.levelAnimation.Init(); this.Failure = GameUITools.FindGameObject("Failure", base.gameObject); this.Failure.AddComponent<GUIFailureTipsGroup>(); this.Failure.SetActive(false); this.Victory = GameUITools.FindGameObject("Victory", base.gameObject); this.Victory.SetActive(false); this.VictoryTips = this.Victory.transform.Find("Tips").GetComponent<UILabel>(); this.RewardItem = GameUITools.FindGameObject("Reward", base.gameObject); this.RewardItem.SetActive(false); }
void Awake() { Instance = this; base.Init(); m_tab = GetUIChild("EquipExchangeTab").GetComponent<MogoSingleButtonList>(); Transform listRoot = GetUIChild("EquipExchangeEquipList"); m_tranDragableCamera = GetUIChild("EquipExchangeEquipListCamera"); m_dragableCamera = m_tranDragableCamera.GetComponentsInChildren<MyDragableCamera>(true)[0]; m_dragableCamera.LeftArrow = GetUIChild("EquipExchangeArrowLeft").gameObject; m_dragableCamera.RightArrow = GetUIChild("EquipExchangeArrowRight").gameObject; Transform dragCameraBegin = GetUIChild("EquipExchangeEquipListCameraPosBegin"); GetUIChild("EquipExchangeContainerCloseBtn").gameObject.AddComponent<MogoUIListener>().MogoOnClick = () => { Hide(); }; m_listView = new MogoListView(m_tranDragableCamera, listRoot, dragCameraBegin, GRID_PREFAB_NAME, true, GRID_GAP, GRID_NUM_PER_PAGE, m_objList); m_lblGoldNum = GetUIChild("EquipExchangeResourceGoldNumLbl").GetComponent<UILabel>(); m_lblMaterilNum = GetUIChild("EquipExchangeResourceDiamondNumLbl").GetComponent<UILabel>(); m_imgMaterial = GetUIChild("EquipExchangeResourceDiamondIcon").GetComponent<UISprite>(); GetUIChild("EquipExchangeTabBtn1").gameObject.AddComponent<MogoUIListener>().MogoOnClick = () => { if (OnTabSelect != null) OnTabSelect(0); }; GetUIChild("EquipExchangeTabBtn2").gameObject.AddComponent<MogoUIListener>().MogoOnClick = () => { if (OnTabSelect != null) OnTabSelect(1); }; gameObject.SetActive(false); }
// Use this for initialization void Start () { gameCon = GameObject.Find("GameCon").GetComponent<GameCon>(); uiSprite = this.GetComponent<UISprite> (); timer = 0; bStartFade = false; }
GameObject Tank;//玩家的坦克(用来获取坦克的位置) // Use this for initialization void Start () { Tank = GameObject.Find("First96A").gameObject; sprCD = transform.FindChild("sprCD").GetComponent<UISprite>(); sprCD.fillAmount = 0; }
void Awake() { m_myTransform = transform; m_spFriendHead = m_myTransform.FindChild("FriendHeadImage").GetComponentsInChildren<UISprite>(true)[0]; m_lblFriendLevel = m_myTransform.FindChild("FriendLevel").GetComponentsInChildren<UILabel>(true)[0]; m_lblFightingPower = m_myTransform.FindChild("FightingPower").GetComponentsInChildren<UILabel>(true)[0]; m_lblFriendName = m_myTransform.FindChild("FriendName").GetComponentsInChildren<UILabel>(true)[0]; m_spLeaveMessageSign = m_myTransform.FindChild("LeaveMessageSign").GetComponentsInChildren<UISprite>(true)[0]; m_spWishStrenthSign = m_myTransform.FindChild("WishStrenthSign").GetComponentsInChildren<UISprite>(true)[0]; m_lblFriendHasWishTip = m_myTransform.FindChild("FriendHasWishTip").GetComponentsInChildren<UILabel>(true)[0]; for (int i = 0; i < 6; ++i) { m_ArrFriendDegree[i] = m_myTransform.FindChild("FriendDegreeList/Degree" + i).GetComponentsInChildren<UISprite>(true)[0]; if (i == 6) { m_bAllFriendDegreeLoaded = true; } } m_spLeaveMessageSign.GetComponentsInChildren<MogoButton>(true)[0].clickHandler += OnLeaveMessageSignUp; m_spWishStrenthSign.GetComponentsInChildren<MogoButton>(true)[0].clickHandler += OnWishStrenthSignUp; // ChineseData m_lblFriendHasWishTip.text = LanguageData.GetContent(ContentDefine.Friend.WISH_BUTTON_WISHED); }
public void LoadResourceInsteadOfAwake() { if(m_bLoadResourceInsteadOfAwake) return; m_bLoadResourceInsteadOfAwake = true; m_myTransform = transform; FillFullNameData(transform); m_lblCDText = FindTransform("TimeLimitActivityUIActivityInfoCDText").GetComponentsInChildren<UILabel>(true)[0]; m_lblInfoDesc = FindTransform("TimeLimitActivityUIActivityInfoDesc").GetComponentsInChildren<UILabel>(true)[0]; m_spInfoImg = FindTransform("TimeLimitActivityUIActivityInfoImg").GetComponentsInChildren<UISprite>(true)[0]; m_lblRule = FindTransform("TimeLimitActivityUIActivityInfoRule").GetComponentsInChildren<UILabel>(true)[0]; m_lblInfoTitle = FindTransform("TimeLimitActivityUIActivityInfoTitle").GetComponentsInChildren<UILabel>(true)[0]; m_goHasReward = FindTransform("TimeLimitActivityUIActivityInfoHasReward").gameObject; for (int i = 0; i < 4; ++i) { m_arrItem[i] = FindTransform("TimeLimitActivityUIItem" + i).gameObject; m_arrItemGrid.Add(m_arrItem[i].AddComponent<InventoryGrid>()); } m_goGetBtn = FindTransform("TimeLimitActivityUIGetBtn").gameObject; m_spGetBtnBGUp = FindTransform("TimeLimitActivityUIGetBtnBGUp").GetComponentsInChildren<UISprite>(true)[0]; m_goShareBtn = FindTransform("TimeLimitActivityUIShareBtn").gameObject; m_goTimeLimitActivityUIItemListBG = FindTransform("TimeLimitActivityUIItemListBG").gameObject; Initialize(); }
public override void OnInspectorGUI () { serializedObject.Update(); NGUIEditorTools.SetLabelWidth(80f); mButton = target as UIImageButton; mSprite = EditorGUILayout.ObjectField("Sprite", mButton.target, typeof(UISprite), true) as UISprite; if (mButton.target != mSprite) { NGUIEditorTools.RegisterUndo("Image Button Change", mButton); mButton.target = mSprite; if (mSprite != null) mSprite.spriteName = mButton.normalSprite; } if (mSprite != null) { ComponentSelector.Draw<UIAtlas>(mSprite.atlas, OnSelectAtlas, true); if (mSprite.atlas != null) { NGUIEditorTools.DrawSpriteField("Normal", mSprite.atlas, mButton.normalSprite, OnNormal); NGUIEditorTools.DrawSpriteField("Hover", mSprite.atlas, mButton.hoverSprite, OnHover); NGUIEditorTools.DrawSpriteField("Pressed", mSprite.atlas, mButton.pressedSprite, OnPressed); NGUIEditorTools.DrawSpriteField("Disabled", mSprite.atlas, mButton.disabledSprite, OnDisabled); NGUIEditorTools.DrawProperty("Pixel Snap", serializedObject, "pixelSnap"); } } serializedObject.ApplyModifiedProperties(); }
void bgMove( UISprite bg ) { // Debug.Log ( "bg.pixelSize " + bg.pixelSize ); // Debug.Log ( "bg.transform.localScale : " + bg.transform.localScale ); // Debug.Log ( "bg.transform.lossyScale : " + bg.transform.lossyScale ); // Debug.Log ( "bg.localSize" + bg.localSize ); // Debug.Log ( "bg.transform.position" + bg.transform.position ); // Debug.Log ( "bg.transform.localPosition : " + bg.transform.localPosition ); if ( -(bg.localSize.y) >= bg.transform.localPosition.y ) { bgPos.y = bg.localSize.y - ( GameData.bgSpeed * 1000f); bg.transform.localPosition = bgPos ; } else { bgPos = bg.transform.position; bgPos.y -= GameData.bgSpeed; bg.transform.position = bgPos; } }
void Awake(){ _instance = this; headSprite = transform.Find ("HeadSprite").GetComponent<UISprite> (); levelLabel = transform.Find ("LevelLabel").GetComponent<UILabel> (); nameLabel = transform.Find ("NameLabel").GetComponent<UILabel> (); diamondLabel = transform.Find ("DiamondLabel/DiamondNumLabel").GetComponent<UILabel> (); coinLabel = transform.Find ("CoinLabel/CoinNumLabel").GetComponent<UILabel> (); tween = this.GetComponent<TweenPosition> (); closeButton = transform.Find ("CancelButton").GetComponent<UIButton> (); changeNameButton = transform.Find ("ChangeNameButton").GetComponent<UIButton> (); changeNameGo = transform.Find ("ChangeNameBg").gameObject; nameInput = transform.Find ("ChangeNameBg/NameInput").GetComponent<UIInput> (); sureButton = transform.Find ("ChangeNameBg/SureButton").GetComponent<UIButton> (); cancelButton = transform.Find ("ChangeNameBg/CancelButton").GetComponent<UIButton> (); changeNameGo.SetActive (false); EventDelegate ed = new EventDelegate(this,"OnButtonCloseClick"); closeButton.onClick.Add (ed); EventDelegate ed2 = new EventDelegate (this, "OnButtonChangeNameClick"); changeNameButton.onClick.Add (ed2); EventDelegate ed3 = new EventDelegate (this, "OnButtonSureClick"); sureButton.onClick.Add (ed3); EventDelegate ed4 = new EventDelegate (this, "OnButtonCancelClick"); cancelButton.onClick.Add (ed4); PlayerInfo._instance.OnPlayerInfoChanged += this.OnPlayerInfoChanged; }
public override void OnInit() { base.OnInit(); m_ColorList = new List<ColorItem>(); for (int i = 0; i < 5; ++i) { ColorItem elem = new ColorItem(); elem.obj = FindChild("Sprite_Color"+(i)); UIEventListener.Get(elem.obj).onClick = OnDropEnd; var texture = ComponentTool.FindChildComponent<UITexture>("Sprite_Color", elem.obj); elem.color = texture.color; m_ColorList.Add(elem); } m_FireworkPlanList = new List<FireworkPlanElement>(); for (int i = 0; i < 7; ++i) { var objRoot = FindChild("Type_" + i); FireworkPlanElement elem = new FireworkPlanElement(objRoot); elem.SetStatus(true, i<3); m_FireworkPlanList.Add(elem); UIEventListener.Get(objRoot).onClick = OnClickFire; ; } m_ColorPanel = FindChildComponent<UISprite>("Sprite_ColorPanel"); m_BlockBg = FindChild("BlockBg"); AddChildElementClickEvent(OnClickExit,"Button_Exit"); }
public void Init(Transform _trans, UISprite _sprite, float _movementSpeed, float _jumpHeight) { trans = _trans; sprite = _sprite; movementSpeed = _movementSpeed; jumpHeight = _jumpHeight; }
void Awake() { if(digitalSprite == null) digitalSprite = transform.FindChild("Title").GetComponent<UISprite>(); if(digitalSpriteBack == null) digitalSpriteBack = transform.FindChild("TitleBack").GetComponent<UISprite>(); }
public void initResearch(RnDRow aRow,GTCar aCar,UISprite aSprite) { this.gameObject.SetActive(true); researchRow = aRow; carRef = aCar; GTEquippedResearch r = carRef.hasPart(aRow); if(r==null) { partNameTitle.text = aRow._partname+" (0/"+aRow._maxlevelstounlock+")"; } else { partNameTitle.text = aRow._partname+" ("+r.activeLevel+"/"+aRow._maxlevelstounlock+")"; } partDescription.text = aRow._partdescription; // divisionRequired.text = "Division Required: "+aRow._partprerequisitedivision; if(aRow._partprerequisites.Length==0) { prerequisiteParts.text = "Prerequisite Parts: None"; } else { prerequisiteParts.text = "Prerequisite Parts: "+aRow._partprerequisites; } lblCost.text = "Cost to Research: "+aRow._costtoresearch.ToString("C0"); this.lblDaysToResearch.text = "Days to Research: "+aRow._daystoresearch; partGraphic.spriteName = aSprite.spriteName; if(this.carRef.partBeingResearched!=null) { startResearchBtn.isEnabled = false; } }
public float ArmorNum = 1; //护甲的恢复指数 void Awake() { GameObject.Find("bgFailorSucceed").GetComponent<Image>().enabled = false; playerArmor = GameObject.Find("UIfire/PanelBlood/Armor/Foreground").GetComponent<UISprite>(); spriteBlood = GameObject.Find("UIfire/PanelBlood/Blood/SpriteBlood").GetComponent<UISprite>(); print("护甲=" + playerArmor.fillAmount); }
protected override void Init() { A_Sprite = this.GetComponent <UISprite>(); this.onComponentClick = OnComponentClick; this.InitItem(); }
/// <summary> /// Create a popup list or a menu. /// </summary> void CreatePopup(GameObject go, bool isDropDown) { if (NGUISettings.atlas != null) { NGUIEditorTools.DrawSpriteField("Foreground", "Foreground sprite (shown on the button)", NGUISettings.atlas, mListFG, OnListFG, GUILayout.Width(120f)); NGUIEditorTools.DrawSpriteField("Background", "Background sprite (envelops the options)", NGUISettings.atlas, mListBG, OnListBG, GUILayout.Width(120f)); NGUIEditorTools.DrawSpriteField("Highlight", "Sprite used to highlight the selected option", NGUISettings.atlas, mListHL, OnListHL, GUILayout.Width(120f)); } if (ShouldCreate(go, NGUISettings.atlas != null && NGUISettings.ambigiousFont != null)) { int depth = NGUITools.CalculateNextDepth(go); go = NGUITools.AddChild(go); go.name = isDropDown ? "Popup List" : "Popup Menu"; UISpriteData sphl = NGUISettings.atlas.GetSprite(mListHL); UISpriteData spfg = NGUISettings.atlas.GetSprite(mListFG); Vector2 hlPadding = new Vector2(Mathf.Max(4f, sphl.paddingLeft), Mathf.Max(4f, sphl.paddingTop)); Vector2 fgPadding = new Vector2(Mathf.Max(4f, spfg.paddingLeft), Mathf.Max(4f, spfg.paddingTop)); // Background sprite UISprite sprite = NGUITools.AddSprite(go, NGUISettings.atlas, mListFG); sprite.depth = depth; sprite.atlas = NGUISettings.atlas; sprite.pivot = UIWidget.Pivot.Left; sprite.width = Mathf.RoundToInt(150f + fgPadding.x * 2f); sprite.height = Mathf.RoundToInt(NGUISettings.fontSize + fgPadding.y * 2f); sprite.transform.localPosition = Vector3.zero; sprite.MakePixelPerfect(); // Text label UILabel lbl = NGUITools.AddWidget <UILabel>(go); lbl.ambigiousFont = NGUISettings.ambigiousFont; lbl.fontSize = NGUISettings.fontSize; lbl.fontStyle = NGUISettings.fontStyle; lbl.text = go.name; lbl.pivot = UIWidget.Pivot.Left; lbl.cachedTransform.localPosition = new Vector3(fgPadding.x, 0f, 0f); lbl.AssumeNaturalSize(); // Add a collider NGUITools.AddWidgetCollider(go); // Add the popup list UIPopupList list = go.AddComponent <UIPopupList>(); list.atlas = NGUISettings.atlas; list.ambigiousFont = NGUISettings.ambigiousFont; list.fontSize = NGUISettings.fontSize; list.fontStyle = NGUISettings.fontStyle; list.backgroundSprite = mListBG; list.highlightSprite = mListHL; list.padding = hlPadding; if (isDropDown) { EventDelegate.Add(list.onChange, lbl.SetCurrentSelection); } for (int i = 0; i < 5; ++i) { list.items.Add(isDropDown ? ("List Option " + i) : ("Menu Option " + i)); } // Add the scripts go.AddComponent <UIButton>().tweenTarget = sprite.gameObject; go.AddComponent <UIPlaySound>(); Selection.activeGameObject = go; } }
/// <summary> /// Progress bar creation function. /// </summary> void CreateSlider(GameObject go, bool slider) { if (NGUISettings.atlas != null) { NGUIEditorTools.DrawSpriteField("Empty", "Sprite for the background (empty bar)", NGUISettings.atlas, mSliderBG, OnSliderBG, GUILayout.Width(120f)); NGUIEditorTools.DrawSpriteField("Full", "Sprite for the foreground (full bar)", NGUISettings.atlas, mSliderFG, OnSliderFG, GUILayout.Width(120f)); if (slider) { NGUIEditorTools.DrawSpriteField("Thumb", "Sprite for the thumb indicator", NGUISettings.atlas, mSliderTB, OnSliderTB, GUILayout.Width(120f)); } } if (ShouldCreate(go, NGUISettings.atlas != null)) { int depth = NGUITools.CalculateNextDepth(go); go = NGUITools.AddChild(go); go.name = slider ? "Slider" : "Progress Bar"; // Background sprite UISpriteData bgs = NGUISettings.atlas.GetSprite(mSliderBG); UISprite back = (UISprite)NGUITools.AddWidget <UISprite>(go); back.type = bgs.hasBorder ? UISprite.Type.Sliced : UISprite.Type.Simple; back.name = "Background"; back.depth = depth; back.pivot = UIWidget.Pivot.Left; back.atlas = NGUISettings.atlas; back.spriteName = mSliderBG; back.width = 200; back.height = 30; back.transform.localPosition = Vector3.zero; back.MakePixelPerfect(); // Foreground sprite UISpriteData fgs = NGUISettings.atlas.GetSprite(mSliderFG); UISprite front = NGUITools.AddWidget <UISprite>(go); front.type = fgs.hasBorder ? UISprite.Type.Sliced : UISprite.Type.Simple; front.name = "Foreground"; front.pivot = UIWidget.Pivot.Left; front.atlas = NGUISettings.atlas; front.spriteName = mSliderFG; front.width = 200; front.height = 30; front.transform.localPosition = Vector3.zero; front.MakePixelPerfect(); // Add a collider if (slider) { NGUITools.AddWidgetCollider(go); } // Add the slider script UISlider uiSlider = go.AddComponent <UISlider>(); uiSlider.foregroundWidget = front; // Thumb sprite if (slider) { UISpriteData tbs = NGUISettings.atlas.GetSprite(mSliderTB); UISprite thb = NGUITools.AddWidget <UISprite>(go); thb.type = tbs.hasBorder ? UISprite.Type.Sliced : UISprite.Type.Simple; thb.name = "Thumb"; thb.atlas = NGUISettings.atlas; thb.spriteName = mSliderTB; thb.width = 20; thb.height = 40; thb.transform.localPosition = new Vector3(200f, 0f, 0f); thb.MakePixelPerfect(); NGUITools.AddWidgetCollider(thb.gameObject); thb.gameObject.AddComponent <UIButtonColor>(); thb.gameObject.AddComponent <UIButtonScale>(); uiSlider.thumb = thb.transform; } uiSlider.value = 1f; // Select the slider Selection.activeGameObject = go; } }
/// <summary> /// Scroll bar template. /// </summary> void CreateScrollBar(GameObject go) { if (NGUISettings.atlas != null) { NGUIEditorTools.DrawSpriteField("Background", "Sprite used for the background", NGUISettings.atlas, mScrollBG, OnScrollBG, GUILayout.Width(120f)); NGUIEditorTools.DrawSpriteField("Foreground", "Sprite used for the foreground (thumb)", NGUISettings.atlas, mScrollFG, OnScrollFG, GUILayout.Width(120f)); GUILayout.BeginHorizontal(); UIScrollBar.FillDirection dir = (UIScrollBar.FillDirection)EditorGUILayout.EnumPopup("Direction", mFillDir, GUILayout.Width(200f)); GUILayout.Space(20f); GUILayout.Label("Add colliders?", GUILayout.Width(90f)); bool draggable = EditorGUILayout.Toggle(mScrollCL); GUILayout.EndHorizontal(); if (mScrollCL != draggable || mFillDir != dir) { mScrollCL = draggable; mFillDir = dir; Save(); } } if (ShouldCreate(go, NGUISettings.atlas != null)) { int depth = NGUITools.CalculateNextDepth(go); go = NGUITools.AddChild(go); go.name = "Scroll Bar"; UISprite bg = NGUITools.AddWidget <UISprite>(go); bg.type = UISprite.Type.Sliced; bg.name = "Background"; bg.depth = depth; bg.atlas = NGUISettings.atlas; bg.spriteName = mScrollBG; Vector4 border = bg.border; bg.width = Mathf.RoundToInt(400f + border.x + border.z); bg.height = Mathf.RoundToInt(14f + border.y + border.w); bg.MakePixelPerfect(); UISprite fg = NGUITools.AddWidget <UISprite>(go); fg.type = UISprite.Type.Sliced; fg.name = "Foreground"; fg.atlas = NGUISettings.atlas; fg.spriteName = mScrollFG; UIScrollBar sb = go.AddComponent <UIScrollBar>(); sb.foregroundWidget = fg; sb.backgroundWidget = bg; sb.fillDirection = mFillDir; sb.barSize = 0.3f; sb.value = 0.3f; sb.ForceUpdate(); if (mScrollCL) { NGUITools.AddWidgetCollider(bg.gameObject); NGUITools.AddWidgetCollider(fg.gameObject); } Selection.activeGameObject = go; } }
private void Awake() { item = GetComponent <UISprite>(); }
private void Awake() { sprite = this.GetComponent <UISprite>(); }
/// <summary> /// Convenience function. /// </summary> static public Bounds CalculateRelativeInnerBounds(Transform root, UISprite sprite) { if (sprite.type == UISprite.Type.Sliced) { Matrix4x4 toLocal = root.worldToLocalMatrix; Vector2 size = sprite.relativeSize; Vector2 offset = sprite.pivotOffset; Transform toWorld = sprite.cachedTransform; float x = (offset.x + 0.5f) * size.x; float y = (offset.y - 0.5f) * size.y; size *= 0.5f; float sx = toWorld.localScale.x; float sy = toWorld.localScale.y; // Get the border in pixels Vector4 border = sprite.border; // Convert pixels to relative coordinates if (sx != 0f) { border.x /= sx; border.z /= sx; } if (sy != 0f) { border.y /= sy; border.w /= sy; } // Calculate the relative dimensions float left = x - size.x + border.x; float right = x + size.x - border.z; float top = y - size.y + border.y; float bottom = y + size.y - border.w; // Start with the corner of the widget Vector3 v = new Vector3(left, top, 0f); v = toWorld.TransformPoint(v); v = toLocal.MultiplyPoint3x4(v); Bounds b = new Bounds(v, Vector3.zero); // Repeat for the other 3 corners v = new Vector3(left, bottom, 0f); v = toWorld.TransformPoint(v); v = toLocal.MultiplyPoint3x4(v); b.Encapsulate(v); v = new Vector3(right, bottom, 0f); v = toWorld.TransformPoint(v); v = toLocal.MultiplyPoint3x4(v); b.Encapsulate(v); v = new Vector3(right, top, 0f); v = toWorld.TransformPoint(v); v = toLocal.MultiplyPoint3x4(v); b.Encapsulate(v); return(b); } return(CalculateRelativeWidgetBounds(root, sprite.cachedTransform)); }
public static void repositionButtons(int maxButtonsPerLine = -1, List <string> hiddenButtons = null) { GameObject _Base = _SysShortcut.transform.Find("Base").gameObject; GameObject _Grid = _Base.transform.Find("Grid").gameObject; UISprite _UIBase = _Base.GetComponent <UISprite>(); UIGrid _UIGrid = _Grid.GetComponent <UIGrid>(); List <Transform> children = _UIGrid.GetChildList(); int numButtons = 0; if (hiddenButtons == null) { numButtons = children.Count; } else { foreach (Transform child in children) { if (!hiddenButtons.Contains(child.name)) { numButtons++; } } } float width = _UIGrid.cellWidth; float height = width; _UIGrid.pivot = UIWidget.Pivot.TopLeft; _UIGrid.arrangement = UIGrid.Arrangement.CellSnap; _UIGrid.sorting = UIGrid.Sorting.None; _UIGrid.maxPerLine = (int)(Screen.width / (width / UIRoot.GetPixelSizeAdjustment(_Base)) * (3f / 4f)); if (maxButtonsPerLine > 0) { _UIGrid.maxPerLine = Math.Min(_UIGrid.maxPerLine, maxButtonsPerLine); } int buttonsX = Math.Min(numButtons, _UIGrid.maxPerLine); int buttonsY = Math.Max(1, (numButtons - 1) / _UIGrid.maxPerLine + 1); _UIBase.pivot = UIWidget.Pivot.TopRight; int baseMarginWidth = (int)(width * 3 / 2 + 8); int baseMarginHeight = (int)(height / 2); _UIBase.width = (int)(baseMarginWidth + width * buttonsX); _UIBase.height = (int)(baseMarginHeight + height * buttonsY + 2f); float baseOffsetHeight = baseMarginHeight * 1.5f + 2f; _UIBase.transform.localPosition = new Vector3(946f, 502f + baseOffsetHeight, 0f); _UIGrid.transform.localPosition = new Vector3(-2f - 2 * width, -baseOffsetHeight, 0f); List <string> UIButtons = new List <string>(DefaultUIButtons); if (GameMain.Instance.CMSystem.NetUse) { UIButtons.Insert(3, "Shop"); } int i = 0; for (int j = 0; j < UIButtons.Count; j++) { foreach (Transform child in children) { if (hiddenButtons != null && hiddenButtons.Contains(child.name)) { child.localPosition = new Vector3(10000, 10000); } else if (child.name == UIButtons[j]) { child.localPosition = new Vector3((i % _UIGrid.maxPerLine) * -width, (i / _UIGrid.maxPerLine) * -height, 0f); i++; } } } foreach (Transform child in children) { if (hiddenButtons != null && hiddenButtons.Contains(child.name)) { child.localPosition = new Vector3(10000, 10000); } else if (!UIButtons.Contains(child.name)) { child.localPosition = new Vector3((i % _UIGrid.maxPerLine) * -width, (i / _UIGrid.maxPerLine) * -height, 0f); i++; } } UISprite _tooltip = typeof(SystemShortcut).GetField("m_spriteExplanation", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(_SysShortcut) as UISprite; Vector3 pos = _tooltip.transform.localPosition; pos.y = _Base.transform.localPosition.y - _UIBase.height - _tooltip.height; _tooltip.transform.localPosition = pos; }
public void FillItemGridData(List <PassRewardGridData> data, Action cb) { ClearRewardItemList(); if (m_mbOK == null) { OKAct = cb; } else { if (cb != null) { m_mbOK.clickHandler = cb; } } for (int i = 0; i < data.Count; ++i) { int index = i; AssetCacheMgr.GetUIInstance("InstanceRewardItem.prefab", (prefab, guid, go) => { GameObject obj = (GameObject)go; obj.transform.parent = m_instanceRewardItemList; obj.transform.localPosition = new Vector3(REWARDITEMSPACE * index, 0, 0); obj.transform.localScale = new Vector3(0.0008f, 0.0008f, 1); UISprite spIcon = obj.transform.FindChild("InstanceRewardItemFG").GetComponentsInChildren <UISprite>(true)[0]; UISprite spBG = obj.transform.FindChild("InstanceRewardItemBG").GetComponentsInChildren <UISprite>(true)[0]; UILabel lblNum = obj.transform.FindChild("InstanceRewardItemCount").GetComponentsInChildren <UILabel>(true)[0]; UILabel lblName = obj.transform.FindChild("InstanceRewardItemText").GetComponentsInChildren <UILabel>(true)[0]; InventoryManager.SetIcon(data[index].id, spIcon, 0, null, spBG); if (lblNum != null) { lblNum.text = ""; lblName.text = data[index].iconName; lblNum.text = string.Concat("x", data[index].num); } Mogo.Util.LoggerHelper.Debug("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ " + spIcon.spriteName); m_listItem.Add(obj); if (index == data.Count - 1) { if (m_camItemList == null) { LoggerHelper.Debug("m_camItemList is null"); m_camItemList = FindTransform("InstancePassRewardItemListCamera").GetComponentsInChildren <Camera>(true)[0]; m_camItemList.GetComponentsInChildren <UIViewport>(true)[0].sourceCamera = GameObject.Find("MogoMainUI").transform.FindChild("Camera").GetComponentsInChildren <Camera>(true)[0]; } if (m_listItem.Count <= 5) { if (m_camItemList != null) { m_camItemList.transform.localPosition = m_vec3StartPos[index]; } else { LoggerHelper.Error("m_camItemList is null"); } } else { if (m_camItemList != null) { m_camItemList.transform.localPosition = m_vec3StartPos[4]; } else { LoggerHelper.Error("m_camItemList is null"); } } if (IsWin) { PlayVictoryAnimation(); } } }); } }
void Awake() { uiSprite = GetComponent <UISprite>(); }
// Use this for initialization void Start() { sprite1 = gameObject.GetComponent <UISprite>(); sprite1.GetComponent <Button>().onClick = ClickDown; }
//窗口控件初始化 protected override void InitWidget() { mMidShow = mRoot.Find("Animator_Area"); //中间区域 mLockList.Clear(); mHeroShowList.Clear(); mSpriteBlackList.Clear(); for (int i = 0; i < HeroCtrl.Instance.heroInfoList.Count; i++) { #region 加载选择英雄显示预设 GameObject objLoad = null; ResourceItem objUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.HeroShowBoxUI, ResourceType.PREFAB); objLoad = GameObject.Instantiate(objUnit.Asset) as GameObject; objLoad.transform.parent = mMidShow.Find("HeroBox").Find("Grid"); objLoad.transform.localScale = Vector3.one; objLoad.transform.localPosition = Vector3.zero; objLoad.name = "HeroBox" + (i + 1).ToString(); UIToggle toggle = objLoad.GetComponent <UIToggle>(); toggle.group = mHeroShowGroup; mHeroShowList.Add(toggle); #endregion #region 显示英雄选择ICON图片 //black mShowAlpha = mRoot.Find("Animator_Area"); Transform selecParent = objLoad.transform.Find("HeroThumbnails"); mSpriteBlackList.Add(selecParent.Find("Clip").GetComponent <UISprite>());//黑色透明图片 //head 头像 HeroThumbnails/head UISprite sprite = selecParent.Find("Head").GetComponent <UISprite>(); sprite.spriteName = HeroCtrl.Instance.heroInfoList[i].HeroSelectHead.ToString(); //lock 锁图标 Transform lockT = objLoad.transform.Find("Lock"); lockT.gameObject.SetActive(false); mLockList.Add(lockT); #endregion } #region 获得描述预设 Transform desParent = mMidShow.Find("HeroDestribe"); mHeroName = desParent.Find("Name").Find("Label").GetComponent <UILabel>(); Transform skillTran = desParent.Find("Skill"); mSkillDes = skillTran.Find("Instruction").GetComponent <UILabel>(); mSkillDes2 = skillTran.Find("Instruction2").GetComponent <UILabel>(); mSkillDes3 = skillTran.Find("Instruction3").GetComponent <UILabel>(); mSpriteDes = desParent.Find("Portrait").Find("Sprite").GetComponent <UISprite>(); mSkilltex = skillTran.Find("Icon1").GetComponent <UISprite>(); mSkilltex1 = skillTran.Find("Icon2").GetComponent <UISprite>(); mSkilltex2 = skillTran.Find("Icon3").GetComponent <UISprite>(); #endregion #region 获得英雄头像预设 mTeamLeft = mRoot.Find("TeamSelectInfo"); mTeamRight = mRoot.Find("EnemySelectInfo"); int index = 1; for (int j = 0; j < mHeroCount; j++) { Transform teamParent = null; if (j % 2 == 0) { //左边三个 j = 0,2,4 , i = 1,2,3 teamParent = mTeamLeft; //幽月精灵 } else { //右边三个 j = 1,3,5, i = 1,2,3 teamParent = mTeamRight; //嗜热炎魔 } Transform parent = teamParent.Find("Player" + index.ToString()); //玩家 mSpriteDic[j] = parent.Find("Thumbnail").GetComponent <UISprite>(); //玩家选定的英雄头像 mLabelName[j] = parent.Find("Name").GetComponent <UILabel>(); //玩家名称 mLabelName[j].text = ""; mSpriteSelectDic[j] = parent.Find("Frame").GetComponent <UISprite>(); //外围边框 mLabelDic[j] = parent.Find("ConfirmBar"); // 已选定图像 if (j % 2 != 0) { index += 1; } } #endregion #region 确定 mBtnSure = mMidShow.Find("ConfirmButton").GetComponent <ButtonOnPress>(); mObjHightLight = mBtnSure.transform.Find("Highlight").gameObject; mObjCanPress = mBtnSure.transform.Find("Show").gameObject; #endregion #region 购买界面 mBuyParent = mRoot.Find("SureToBuyHero"); Transform buyParentHero = mBuyParent.Find("Hero"); mSpriteBuyDes = buyParentHero.Find("Portrait").GetComponent <UISprite>(); mLabelBuyName = buyParentHero.Find("Name").GetComponent <UILabel>();; mLabelBuySkill = buyParentHero.Find("Skill").Find("Instruction").GetComponent <UILabel>(); mLabelBuyDes = buyParentHero.Find("Story").GetComponent <UILabel>(); mBtnCloseBuy = mBuyParent.Find("Background").GetComponent <ButtonOnPress>(); mBtnBuy = mBuyParent.Find("Buy").GetComponent <ButtonOnPress>(); //符文 mSkinsToggle = mRoot.Find("TurnPage/SelectSkins").GetComponent <UIToggle>(); mSkinsDisable = mRoot.Find("TurnPage/SelectSkins/Disable").gameObject; mSkinsSubmit = mRoot.Find("SkinsInterface/ConfirmButton").GetComponent <UIButton>(); mRunePages = mRoot.Find("SkinsInterface/RunePages").GetComponent <UIPopupList>(); mSkinsHeroName = mRoot.Find("SkinsInterface/DefaultSkin/NamePlate/Name").GetComponent <UILabel>(); mSkinsHeroIcon = mRoot.Find("SkinsInterface/DefaultSkin/Portrait").GetComponent <UISprite>(); EventDelegate.Add(mRunePages.onChange, OnRunePageChange); #endregion #region 倒计时 for (int i = 0; i < 2; i++) { mSpriteTens[i] = mRoot.Find("TopBar" + (i + 1).ToString()).Find("Minute1").GetComponent <UISprite>(); //十位 mSpriteUnits[i] = mRoot.Find("TopBar" + (i + 1).ToString()).Find("Minute2").GetComponent <UISprite>(); //各位 } SetTime(0, mFirstCountTime); SetTime(1, mSecondCountTime); #endregion mArrowUpDown[0] = mMidShow.transform.Find("Arrow/Left"); mArrowUpDown[1] = mMidShow.transform.Find("Arrow/Right"); mScrollView = mMidShow.transform.Find("HeroBox").GetComponent <UIScrollView>(); //这里发送服务器记录的ui点击事件消息 SendUIEventMsg(); }
// 新系统解锁.. public void CheckSystemLock() { /* * ShowSystemUnlockWnd("Btn_Pet"); * return; */ GameObject panel = GameObject.Find("Sys1"); Hashtable table = sdConfDataMgr.Instance().GetTable("systemlock"); if (table != null) { foreach (DictionaryEntry de in table) { string sys = de.Key as string; Hashtable t = de.Value as Hashtable; bool bLock = true; if (sdConfDataMgr.Instance().GetRoleSetting(sys) != "") { // 之前就打开的系统.. bLock = false; } else { // 是否新解锁系统.. int condition = int.Parse(t["condition"] as String); if (condition >= 10000) { // 关卡为解锁条件.. for (int i = 0; i < sdLevelInfo.levelInfos.Length; i++) { if (sdLevelInfo.levelInfos[i].levelID == condition) { if (sdLevelInfo.levelInfos[i].valid) { bLock = false; } break; } } } else { // 等级为解锁条件.. Hashtable role = sdGlobalDatabase.Instance.globalData["MainCharBaseProp"] as Hashtable; if ((int)role["Level"] >= condition) { bLock = false; } } // 新解锁系统.. if (bLock == false) { sdConfDataMgr.Instance().SetRoleSetting(sys, "1"); // 先关掉系统解锁效果.. ShowSystemUnlockWnd(sys); } } // 系统开关.. Transform btn = panel.transform.FindChild(sys); Transform spLock = btn.FindChild("sp_lock"); if (bLock == false) { if (spLock != null) { spLock.gameObject.SetActive(false); } btn.GetComponent <sdRoleWndButton>().mSystemLock = false; UISprite sp = btn.FindChild("Background").GetComponent <UISprite>(); sp.color = new Color(1.0f, 1.0f, 1.0f); } else { btn.GetComponent <sdRoleWndButton>().mSystemLock = true; btn.GetComponent <sdRoleWndButton>().mSystemLockInfo = t["lockinfo"] as String; UISprite sp = btn.FindChild("Background").GetComponent <UISprite>(); sp.color = new Color(0.7f, 0.7f, 0.7f); } } } }
public void destroyLifeBar(UISprite aLifeBar) { Destroy(aLifeBar.gameObject); }
protected void Awake() { this.m_Author = base.Find <UILabel>("Author"); this.m_FileList = base.Find <UIListBox>("MapList"); base.ClearListing(); m_FileList.ClearEventInvocations("eventSelectedIndexChanged"); this.m_FileList.eventSelectedIndexChanged += new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnMapSelectionChanged); this.m_MapName = base.Find <UITextField>("MapName"); this.m_MapName.ClearEventInvocations("eventTextChanged"); //this.m_MapName.eventTextChanged += (c, t) => (this.m_Virgin = false); this.m_SnapShot = base.Find <UITextureSprite>("SnapShot"); this.m_BuildableArea = base.Find <UILabel>("BuildableArea"); this.m_OilResources = base.Find <UIProgressBar>("ResourceBarOil"); this.m_OreResources = base.Find <UIProgressBar>("ResourceBarOre"); this.m_ForestryResources = base.Find <UIProgressBar>("ResourceBarForestry"); this.m_FertilityResources = base.Find <UIProgressBar>("ResourceBarFarming"); this.m_WaterResources = base.Find <UIProgressBar>("ResourceBarWater"); this.m_OilNoResources = base.Find("ResourceOil").Find <UISprite>("NoNoNo"); this.m_OreNoResources = base.Find("ResourceOre").Find <UISprite>("NoNoNo"); this.m_ForestryNoResources = base.Find("ResourceForestry").Find <UISprite>("NoNoNo"); this.m_FertilityNoResources = base.Find("ResourceFarming").Find <UISprite>("NoNoNo"); this.m_WaterNoResources = base.Find("ResourceWater").Find <UISprite>("NoNoNo"); this.m_Highway = base.Find <UISprite>("Highway"); this.m_NoHighway = this.m_Highway.Find <UISprite>("NoNoNo"); this.m_InHighway = this.m_Highway.Find <UISprite>("Incoming"); this.m_OutHighway = this.m_Highway.Find <UISprite>("Outgoing"); this.m_Train = base.Find <UISprite>("Train"); this.m_NoTrain = this.m_Train.Find <UISprite>("NoNoNo"); this.m_InTrain = this.m_Train.Find <UISprite>("Incoming"); this.m_OutTrain = this.m_Train.Find <UISprite>("Outgoing"); this.m_Ship = base.Find <UISprite>("Ship"); this.m_NoShip = this.m_Ship.Find <UISprite>("NoNoNo"); this.m_InShip = this.m_Ship.Find <UISprite>("Incoming"); this.m_OutShip = this.m_Ship.Find <UISprite>("Outgoing"); this.m_Plane = base.Find <UISprite>("Plane"); this.m_NoPlane = this.m_Plane.Find <UISprite>("NoNoNo"); this.m_InPlane = this.m_Plane.Find <UISprite>("Incoming"); this.m_OutPlane = this.m_Plane.Find <UISprite>("Outgoing"); this.m_Start = this.Find <UIButton>("Start"); m_Start.ClearEventInvocations("eventClick"); this.m_Start.eventClick += new MouseEventHandler(this.OnStartClick); m_Start.color = Color.red; this.Refresh(); var joinPanel = transform.GetComponent <UIPanel>(); m_playersLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_playersLabel, "Players: ", 505, 100); m_pingLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_pingLabel, "Ping: ", 505, 125); m_errorLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_errorLabel, "", 505, 150); NetPeerConfiguration config = new NetPeerConfiguration("FPSMod"); config.SetMessageTypeEnabled(NetIncomingMessageType.UnconnectedData, true); m_netClient = new NetClient(config); m_netClient.Start(); }
/// <summary> /// Display the drop-down list when the game object gets clicked on. /// </summary> void OnClick() { if (enabled && NGUITools.GetActive(gameObject) && mChild == null && atlas != null && isValid && items.Count > 0) { mLabelList.Clear(); // Automatically locate the panel responsible for this object if (mPanel == null) { mPanel = UIPanel.Find(transform); if (mPanel == null) { return; } } // Disable the navigation script handleEvents = true; // Calculate the dimensions of the object triggering the popup list so we can position it below it Transform myTrans = transform; Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(myTrans.parent, myTrans); // Create the root object for the list mChild = new GameObject("Drop-down List"); mChild.layer = gameObject.layer; Transform t = mChild.transform; t.parent = myTrans.parent; t.localPosition = bounds.min; t.localRotation = Quaternion.identity; t.localScale = Vector3.one; // Add a sprite for the background mBackground = NGUITools.AddSprite(mChild, atlas, backgroundSprite); mBackground.pivot = UIWidget.Pivot.TopLeft; mBackground.depth = NGUITools.CalculateNextDepth(mPanel.gameObject); mBackground.color = backgroundColor; // We need to know the size of the background sprite for padding purposes Vector4 bgPadding = mBackground.border; mBgBorder = bgPadding.y; mBackground.cachedTransform.localPosition = new Vector3(0f, bgPadding.y, 0f); // Add a sprite used for the selection mHighlight = NGUITools.AddSprite(mChild, atlas, highlightSprite); mHighlight.pivot = UIWidget.Pivot.TopLeft; mHighlight.color = highlightColor; UISpriteData hlsp = mHighlight.GetAtlasSprite(); if (hlsp == null) { return; } float hlspHeight = hlsp.borderTop; float fontHeight = activeFontSize; float dynScale = activeFontScale; float labelHeight = fontHeight * dynScale; float x = 0f, y = -padding.y; int labelFontSize = (bitmapFont != null) ? bitmapFont.defaultSize : fontSize; List <UILabel> labels = new List <UILabel>(); // Run through all items and create labels for each one for (int i = 0, imax = items.Count; i < imax; ++i) { string s = items[i]; UILabel lbl = NGUITools.AddWidget <UILabel>(mChild); lbl.name = i.ToString(); lbl.pivot = UIWidget.Pivot.TopLeft; lbl.bitmapFont = bitmapFont; lbl.trueTypeFont = trueTypeFont; lbl.fontSize = labelFontSize; lbl.fontStyle = fontStyle; lbl.text = isLocalized ? Localization.Get(s) : s; lbl.color = textColor; lbl.cachedTransform.localPosition = new Vector3(bgPadding.x + padding.x, y, -1f); lbl.overflowMethod = UILabel.Overflow.ResizeFreely; lbl.alignment = alignment; lbl.MakePixelPerfect(); if (dynScale != 1f) { lbl.cachedTransform.localScale = Vector3.one * dynScale; } labels.Add(lbl); y -= labelHeight; y -= padding.y; x = Mathf.Max(x, lbl.printedSize.x); // Add an event listener UIEventListener listener = UIEventListener.Get(lbl.gameObject); listener.onHover = OnItemHover; listener.onPress = OnItemPress; listener.onClick = OnItemClick; listener.parameter = s; // Move the selection here if this is the right label if (mSelectedItem == s || (i == 0 && string.IsNullOrEmpty(mSelectedItem))) { Highlight(lbl, true); } // Add this label to the list mLabelList.Add(lbl); } // The triggering widget's width should be the minimum allowed width x = Mathf.Max(x, bounds.size.x * dynScale - (bgPadding.x + padding.x) * 2f); float cx = x / dynScale; Vector3 bcCenter = new Vector3(cx * 0.5f, -fontHeight * 0.5f, 0f); Vector3 bcSize = new Vector3(cx, (labelHeight + padding.y) / dynScale, 1f); // Run through all labels and add colliders for (int i = 0, imax = labels.Count; i < imax; ++i) { UILabel lbl = labels[i]; NGUITools.AddWidgetCollider(lbl.gameObject); lbl.autoResizeBoxCollider = false; BoxCollider bc = lbl.GetComponent <BoxCollider>(); if (bc != null) { bcCenter.z = bc.center.z; bc.center = bcCenter; bc.size = bcSize; } else { BoxCollider2D b2d = lbl.GetComponent <BoxCollider2D>(); b2d.offset = bcCenter; b2d.size = bcSize; } } int lblWidth = Mathf.RoundToInt(x); x += (bgPadding.x + padding.x) * 2f; y -= bgPadding.y; // Scale the background sprite to envelop the entire set of items mBackground.width = Mathf.RoundToInt(x); mBackground.height = Mathf.RoundToInt(-y + bgPadding.y); // Set the label width to make alignment work for (int i = 0, imax = labels.Count; i < imax; ++i) { UILabel lbl = labels[i]; lbl.overflowMethod = UILabel.Overflow.ShrinkContent; lbl.width = lblWidth; } // Scale the highlight sprite to envelop a single item float scaleFactor = 2f * atlas.pixelSize; float w = x - (bgPadding.x + padding.x) * 2f + hlsp.borderLeft * scaleFactor; float h = labelHeight + hlspHeight * scaleFactor; mHighlight.width = Mathf.RoundToInt(w); mHighlight.height = Mathf.RoundToInt(h); bool placeAbove = (position == Position.Above); if (position == Position.Auto) { UICamera cam = UICamera.FindCameraForLayer(gameObject.layer); if (cam != null) { Vector3 viewPos = cam.cachedCamera.WorldToViewportPoint(myTrans.position); placeAbove = (viewPos.y < 0.5f); } } // If the list should be animated, let's animate it by expanding it if (isAnimated) { float bottom = y + labelHeight; Animate(mHighlight, placeAbove, bottom); for (int i = 0, imax = labels.Count; i < imax; ++i) { Animate(labels[i], placeAbove, bottom); } AnimateColor(mBackground); AnimateScale(mBackground, placeAbove, bottom); } // If we need to place the popup list above the item, we need to reposition everything by the size of the list if (placeAbove) { t.localPosition = new Vector3(bounds.min.x, bounds.max.y - y - bgPadding.y, bounds.min.z); } } else { OnSelect(false); } }
IEnumerator loadDataCo() { yield return(new WaitForSeconds(.5f)); if (listGridRoot != null) { foreach (Transform item in listGridRoot.transform) { Destroy(item.gameObject); } List <GameAchievement> achievements = GameAchievements.Instance.GetAll(); LogUtil.Log("Load Achievements: achievements.Count: " + achievements.Count); int i = 0; int totalPoints = 0; foreach (GameAchievement achievement in achievements) { GameObject item = NGUITools.AddChild(listGridRoot, listItemPrefab); item.name = "AchievementItem" + i; item.transform.FindChild("LabelName").GetComponent <UILabel>().text = achievement.display_name; item.transform.FindChild("LabelDescription").GetComponent <UILabel>().text = achievement.description; GameObject iconObject = item.transform.FindChild("Icon").gameObject; UISprite iconSprite = iconObject.GetComponent <UISprite>(); bool completed = GameProfiles.Current.CheckIfAttributeExists(achievement.code); if (completed) { completed = GameProfileAchievements.Current.GetAchievementValue(achievement.code); } if (!completed) { completed = GameProfileAchievements.Current.GetAchievementValue(achievement.code + "_" + achievement.pack_code); } string points = ""; if (completed) { int currentPoints = achievement.data.points; totalPoints += currentPoints; points = "+" + currentPoints.ToString(); if (iconSprite != null) { iconSprite.alpha = 1f; } } else { if (iconSprite != null) { iconSprite.alpha = .33f; } } item.transform.FindChild("LabelPoints").GetComponent <UILabel>().text = points; // Get trophy icon i++; } if (labelPoints != null) { labelPoints.text = totalPoints.ToString("N0"); } yield return(new WaitForEndOfFrame()); listGridRoot.GetComponent <UIGrid>().Reposition(); yield return(new WaitForEndOfFrame()); } }
//窗口控件初始化 protected override void InitWidget() { mBtnClose = mRoot.Find("CloseBtn").GetComponent <UIButton>(); RuneConfigInfo sRuneConfigInfo = ConfigReader.GetRuneFromID((UInt32)m_MarketGoodsInfo.mGoodsId); if (null == sRuneConfigInfo) { Debug.LogError("null cfg with runeid " + m_MarketGoodsInfo.mGoodsId); return; } UISprite icon = mRoot.Find("Icon").GetComponent <UISprite>(); icon.spriteName = sRuneConfigInfo.Icon; //如果只有一个金钱需要居中 bool ifNeedCentral = m_MarketGoodsInfo.RLGoldPrice < 0 || m_MarketGoodsInfo.RLDiamondPrice < 0; if (ifNeedCentral) { m_SingleBuyBtn = mRoot.Find("BuyBtn/Single").GetComponent <UIButton>(); if (m_MarketGoodsInfo.RLGoldPrice >= 0) { UILabel label = m_SingleBuyBtn.gameObject.transform.Find("Gold/label").GetComponent <UILabel>(); label.text = Convert.ToString(m_MarketGoodsInfo.RLGoldPrice); UIEventListener.Get(m_SingleBuyBtn.gameObject).onClick += OnBuyByGold; } else { UILabel label = m_SingleBuyBtn.gameObject.transform.Find("Crystal/label").GetComponent <UILabel>(); label.text = Convert.ToString(m_MarketGoodsInfo.RLGoldPrice); UIEventListener.Get(m_SingleBuyBtn.gameObject).onClick += OnBuyByDiamond; } m_SingleBuyBtn.gameObject.name = Convert.ToString(m_MarketGoodsInfo.mGoodsId); } else { GameObject bothGo = mRoot.Find("BuyBtn/Both").gameObject; bothGo.SetActive(true); GameObject singleGo = mRoot.Find("BuyBtn/Single").gameObject; singleGo.SetActive(false); mBtnGold = mRoot.Find("BuyBtn/Both/Gold").GetComponent <UIButton>(); mBtnGold.gameObject.SetActive(true); UILabel label = mBtnGold.gameObject.transform.Find("label").GetComponent <UILabel>(); label.text = Convert.ToString(m_MarketGoodsInfo.RLGoldPrice); mBtnGold.gameObject.name = Convert.ToString(m_MarketGoodsInfo.mGoodsId); mBtnDiamond = mRoot.Find("BuyBtn/BuyBtn/Crystal").GetComponent <UIButton>(); mBtnDiamond.gameObject.SetActive(true); UILabel diamondLabel = mBtnDiamond.gameObject.transform.Find("label").GetComponent <UILabel>(); diamondLabel.text = Convert.ToString(m_MarketGoodsInfo.RLDiamondPrice); mBtnDiamond.gameObject.name = Convert.ToString(m_MarketGoodsInfo.mGoodsId); UIEventListener.Get(mBtnGold.gameObject).onClick += OnBuyByGold; UIEventListener.Get(mBtnDiamond.gameObject).onClick += OnBuyByDiamond; } m_NameLabel = mRoot.Find("Name").GetComponent <UILabel>(); m_NameLabel.text = sRuneConfigInfo.RuneName; m_DesptionLabel = mRoot.Find("RuneStatus").GetComponent <UILabel>(); m_DesptionLabel.text = "属性:" + sRuneConfigInfo.Description; mRoot.gameObject.SetActive(true); InitWindowEvent(); }
void Awake() { sp = this.GetComponent <UISprite>(); index = int.Parse(transform.name.Substring(5)); }
void Awake() { m_instance = this; m_spMarketUIMogoUIRefreshCtrl = transform.Find("MarketUIMogoUIRefreshCtrl").GetComponentsInChildren <UISprite>(true)[0]; keyView = transform.Find("keyView").gameObject; keyActivateBtn = keyView.transform.Find("Button").GetComponent <MogoButton>(); keyInput = keyView.transform.Find("Input").GetComponent <UIInput>(); // 热销 hotImgBtn = transform.Find("hot").GetComponent <UIImageButton>(); hot = transform.Find("hot").GetComponent <MogoButton>(); hot.clickHandler = HotList; hot.pressHandler = HotPress; // 等级礼包 itemImgBtn = transform.Find("item").GetComponent <UIImageButton>(); item = transform.Find("item").GetComponent <MogoButton>(); item.clickHandler = ItemList; item.pressHandler = ItemPress; m_goItemIconNotice = transform.Find("item/ItemIconNotice").gameObject; // 宝石 jewelImgBtn = transform.Find("jewel").GetComponent <UIImageButton>(); jewel = transform.Find("jewel").GetComponent <MogoButton>(); jewel.clickHandler = JewelList; jewel.pressHandler = JewelPress; // 激活码礼包 keyImgBtn = transform.Find("key").GetComponent <UIImageButton>(); key = transform.Find("key").GetComponent <MogoButton>(); key.clickHandler = KeyView; key.pressHandler = KeyPress; keyActivateBtn.clickHandler = Activate; //翅膀 wingImgBtn = transform.Find("Wing").GetComponent <UIImageButton>(); wing = transform.Find("Wing").GetComponent <MogoButton>(); wing.clickHandler = WingView; wing.pressHandler = WingPress; m_marketUIBtnClose = transform.Find("MarketUIBtnClose").GetComponentsInChildren <MogoButton>(true)[0]; m_marketUIBtnClose.clickHandler = CloseHandler; m_goMarketUIArrowL = transform.Find("MarketUIArrow/MarketUIArrowL").gameObject; m_goMarketUIArrowR = transform.Find("MarketUIArrow/MarketUIArrowR").gameObject; pay = transform.Find("MarketUIBtnPay").GetComponent <MogoButton>(); rmb = transform.Find("MarketUIDiamondNum").GetComponent <UILabel>(); page = transform.Find("MarketUIPageNum").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.HotTab] = transform.Find("hot/HotLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.JewelTab] = transform.Find("jewel/JewelLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.ItemTab] = transform.Find("item/ItemLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.KeyTab] = transform.Find("key/KeyLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.WingTab] = transform.Find("Wing/WingLabel").GetComponent <UILabel>(); foreach (var pair in m_MarketTabLabelList) { if (pair.Key == (int)MarketUITab.HotTab) { MarketTabDown(pair.Key); } else { MarketTabUp(pair.Key); } } // ChineseData if (m_MarketTabLabelList[(int)MarketUITab.HotTab] != null) { m_MarketTabLabelList[(int)MarketUITab.HotTab].text = LanguageData.GetContent(200011); // "热销"; } if (m_MarketTabLabelList[(int)MarketUITab.JewelTab] != null) { m_MarketTabLabelList[(int)MarketUITab.JewelTab].text = LanguageData.GetContent(200012); // "宝石"; } if (m_MarketTabLabelList[(int)MarketUITab.ItemTab] != null) { m_MarketTabLabelList[(int)MarketUITab.ItemTab].text = LanguageData.GetContent(200013); // "道具"; } if (m_MarketTabLabelList[(int)MarketUITab.KeyTab] != null) { m_MarketTabLabelList[(int)MarketUITab.KeyTab].text = LanguageData.GetContent(200014); // "激活码"; } if (m_MarketTabLabelList[(int)MarketUITab.WingTab] != null) { m_MarketTabLabelList[(int)MarketUITab.WingTab].text = LanguageData.GetContent(7525); //翅膀 } gameObject.transform.Find("MarketUIBtnPay/MarketUIBtnPayText").GetComponent <UILabel>().text = LanguageData.GetContent(5001); // "充值"; Transform cell = transform.Find("list/PropCell"); Transform listStage = transform.Find("list"); listView = listStage.GetComponent <MogoList>(); listView.turnPage = TurnPage; list.Add(new MarketItemView(cell)); for (int ii = 1; ii <= pageSize - 1; ii++) { GameObject copyCell = GameObject.Instantiate(cell.gameObject) as GameObject; MarketItemView itemCell = new MarketItemView(copyCell.transform); itemCell.AddToParent(listStage, gameObject.transform.rotation); list.Add(itemCell); itemCell.LocalPosition = cell.localPosition + new Vector3(CELL_WIDTH * ii, 0, 0); } //pre.clickHandler = PrePage; //next.clickHandler = NextPage; pay.clickHandler = Pay; buy = new MarketBuyView(gameObject.transform.Find("Buy")); buy.Close(); hotImgBtn.SelectedStatus(true); keyView.SetActive(false); EventDispatcher.AddEventListener <MarketItem>(MarketEvent.OpenBuy, OpenBuy); EventDispatcher.AddEventListener <bool>(MarketEvent.LigthArrow, LightArrowHandler); }
public void Init() { sprite = GetComponent <UISprite>(); }
// Token: 0x060001ED RID: 493 RVA: 0x00026148 File Offset: 0x00024548 private void Update() { if (this.Testing) { this.Prompt.enabled = true; } else if (this.LoveManager.RivalWaiting) { if (this.Rival == null) { this.Suitor = this.StudentManager.Students[13]; this.Rival = this.StudentManager.Students[7]; } if (this.Rival.MeetTimer > 0f && this.Suitor.MeetTimer > 0f) { this.Prompt.enabled = true; } } else if (this.Prompt.enabled) { this.Prompt.Hide(); this.Prompt.enabled = false; } if (this.Prompt.Circle[0].fillAmount == 0f) { this.Suitor.enabled = false; this.Rival.enabled = false; this.Rival.Character.GetComponent <Animation>()["f02_smile_00"].layer = 1; this.Rival.Character.GetComponent <Animation>().Play("f02_smile_00"); this.Rival.Character.GetComponent <Animation>()["f02_smile_00"].weight = 0f; this.StudentManager.Clock.StopTime = true; this.Yandere.RPGCamera.enabled = false; this.HeartbeatCamera.SetActive(false); this.Yandere.Headset.SetActive(true); this.Yandere.CanMove = false; this.Yandere.EmptyHands(); this.Yandere.transform.position = this.PeekSpot.position; this.Yandere.transform.eulerAngles = this.PeekSpot.eulerAngles; this.Yandere.Character.GetComponent <Animation>().Play("f02_treePeeking_00"); Camera.main.transform.position = new Vector3(48f, 3f, -44f); Camera.main.transform.eulerAngles = new Vector3(15f, 90f, 0f); this.WisdomLabel.text = "Wisdom: " + DatingGlobals.GetSuitorTrait(2).ToString(); if (!this.Suitor.Rose) { this.RoseIcon.enabled = false; } this.Matchmaking = true; this.UpdateTopics(); } if (this.Matchmaking) { if (this.CurrentAnim != string.Empty && this.Rival.Character.GetComponent <Animation>()[this.CurrentAnim].time >= this.Rival.Character.GetComponent <Animation>()[this.CurrentAnim].length) { this.Rival.Character.GetComponent <Animation>().Play(this.Rival.IdleAnim); } if (this.Phase == 1) { this.Panel.alpha = Mathf.MoveTowards(this.Panel.alpha, 0f, Time.deltaTime); this.Timer += Time.deltaTime; Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, new Vector3(54f, 1.25f, -45.25f), this.Timer * 0.02f); Camera.main.transform.eulerAngles = Vector3.Lerp(Camera.main.transform.eulerAngles, new Vector3(0f, 45f, 0f), this.Timer * 0.02f); if (this.Timer > 5f) { this.Suitor.Character.GetComponent <Animation>().Play("insertEarpiece_00"); this.Suitor.Character.GetComponent <Animation>()["insertEarpiece_00"].time = 0f; this.Suitor.Character.GetComponent <Animation>().Play("insertEarpiece_00"); this.Suitor.Earpiece.SetActive(true); Camera.main.transform.position = new Vector3(45.5f, 1.25f, -44.5f); Camera.main.transform.eulerAngles = new Vector3(0f, -45f, 0f); this.Rotation = -45f; this.Timer = 0f; this.Phase++; } } else if (this.Phase == 2) { this.Timer += Time.deltaTime; if (this.Timer > 4f) { this.Suitor.Earpiece.transform.parent = this.Suitor.Head; this.Suitor.Earpiece.transform.localPosition = new Vector3(0f, -1.12f, 1.14f); this.Suitor.Earpiece.transform.localEulerAngles = new Vector3(45f, -180f, 0f); Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, new Vector3(45.11f, 1.375f, -44f), (this.Timer - 4f) * 0.02f); this.Rotation = Mathf.Lerp(this.Rotation, 90f, (this.Timer - 4f) * 0.02f); Camera.main.transform.eulerAngles = new Vector3(Camera.main.transform.eulerAngles.x, this.Rotation, Camera.main.transform.eulerAngles.z); if (this.Rotation > 89.9f) { this.Rival.Character.GetComponent <Animation>()["f02_turnAround_00"].time = 0f; this.Rival.Character.GetComponent <Animation>().CrossFade("f02_turnAround_00"); this.AffectionBar.localScale = new Vector3(this.Affection / 100f, this.AffectionBar.localScale.y, this.AffectionBar.localScale.z); this.DialogueLabel.text = this.Greetings[this.AffectionLevel]; this.CalculateMultiplier(); this.DatingSimHUD.gameObject.SetActive(true); this.Timer = 0f; this.Phase++; } } } else if (this.Phase == 3) { this.DatingSimHUD.alpha = Mathf.MoveTowards(this.DatingSimHUD.alpha, 1f, Time.deltaTime); if (this.Rival.Character.GetComponent <Animation>()["f02_turnAround_00"].time >= this.Rival.Character.GetComponent <Animation>()["f02_turnAround_00"].length) { this.Rival.transform.eulerAngles = new Vector3(this.Rival.transform.eulerAngles.x, -90f, this.Rival.transform.eulerAngles.z); this.Rival.Character.GetComponent <Animation>().Play("f02_turnAround_00"); this.Rival.Character.GetComponent <Animation>()["f02_turnAround_00"].time = 0f; this.Rival.Character.GetComponent <Animation>()["f02_turnAround_00"].speed = 0f; this.Rival.Character.GetComponent <Animation>().Play("f02_turnAround_00"); this.Rival.Character.GetComponent <Animation>().CrossFade(this.Rival.IdleAnim); this.PromptBar.ClearButtons(); this.PromptBar.Label[0].text = "Confirm"; this.PromptBar.Label[1].text = "Back"; this.PromptBar.Label[4].text = "Select"; this.PromptBar.UpdateButtons(); this.PromptBar.Show = true; this.Phase++; } } else if (this.Phase == 4) { if (this.AffectionGrow) { this.Affection = Mathf.MoveTowards(this.Affection, 100f, Time.deltaTime * 10f); this.CalculateAffection(); } this.Rival.Cosmetic.MyRenderer.materials[2].SetFloat("_BlendAmount", this.Affection * 0.01f); this.Rival.CharacterAnimation["f02_smile_00"].weight = this.Affection * 0.01f; this.Highlight.localPosition = new Vector3(this.Highlight.localPosition.x, Mathf.Lerp(this.Highlight.localPosition.y, this.HighlightTarget, Time.deltaTime * 10f), this.Highlight.localPosition.z); for (int i = 1; i < this.Options.Length; i++) { Transform transform = this.Options[i]; transform.localPosition = new Vector3(Mathf.Lerp(transform.localPosition.x, (i != this.Selected) ? 800f : 750f, Time.deltaTime * 10f), transform.localPosition.y, transform.localPosition.z); } this.AffectionBar.localScale = new Vector3(Mathf.Lerp(this.AffectionBar.localScale.x, this.Affection / 100f, Time.deltaTime * 10f), this.AffectionBar.localScale.y, this.AffectionBar.localScale.z); if (!this.SelectingTopic && !this.Complimenting && !this.ShowingOff && !this.GivingGift) { this.Topics.localScale = Vector3.Lerp(this.Topics.localScale, Vector3.zero, Time.deltaTime * 10f); this.ComplimentSet.localScale = Vector3.Lerp(this.ComplimentSet.localScale, Vector3.zero, Time.deltaTime * 10f); this.ShowOff.localScale = Vector3.Lerp(this.ShowOff.localScale, Vector3.zero, Time.deltaTime * 10f); this.GiveGift.localScale = Vector3.Lerp(this.GiveGift.localScale, Vector3.zero, Time.deltaTime * 10f); if (this.InputManager.TappedUp) { this.Selected--; this.UpdateHighlight(); } if (this.InputManager.TappedDown) { this.Selected++; this.UpdateHighlight(); } if (Input.GetButtonDown("A") && this.Labels[this.Selected].color.a == 1f) { if (this.Selected == 1) { this.SelectingTopic = true; this.Negative = true; } else if (this.Selected == 2) { this.SelectingTopic = true; this.Negative = false; } else if (this.Selected == 3) { this.Complimenting = true; } else if (this.Selected == 4) { this.ShowingOff = true; } else if (this.Selected == 5) { this.GivingGift = true; } else if (this.Selected == 6) { this.PromptBar.ClearButtons(); this.PromptBar.Label[0].text = "Confirm"; this.PromptBar.UpdateButtons(); this.CalculateAffection(); this.DialogueLabel.text = this.Farewells[this.AffectionLevel]; this.Phase++; } } } else if (this.SelectingTopic) { this.Topics.localScale = Vector3.Lerp(this.Topics.localScale, new Vector3(1f, 1f, 1f), Time.deltaTime * 10f); if (this.InputManager.TappedUp) { this.Row--; this.UpdateTopicHighlight(); } else if (this.InputManager.TappedDown) { this.Row++; this.UpdateTopicHighlight(); } if (this.InputManager.TappedLeft) { this.Column--; this.UpdateTopicHighlight(); } else if (this.InputManager.TappedRight) { this.Column++; this.UpdateTopicHighlight(); } if (Input.GetButtonDown("A") && this.TopicIcons[this.TopicSelected].color.a == 1f) { this.SelectingTopic = false; UISprite uisprite = this.TopicIcons[this.TopicSelected]; uisprite.color = new Color(uisprite.color.r, uisprite.color.g, uisprite.color.b, 0.5f); DatingGlobals.SetTopicDiscussed(this.TopicSelected, true); this.DetermineOpinion(); if (!ConversationGlobals.GetTopicLearnedByStudent(this.Opinion, 7)) { ConversationGlobals.SetTopicLearnedByStudent(this.Opinion, 7, true); } if (this.Negative) { UILabel uilabel = this.Labels[1]; uilabel.color = new Color(uilabel.color.r, uilabel.color.g, uilabel.color.b, 0.5f); if (this.Opinion == 2) { this.DialogueLabel.text = "Hey! Just so you know, I take offense to that..."; this.Rival.Character.GetComponent <Animation>().CrossFade("f02_refuse_00"); this.CurrentAnim = "f02_refuse_00"; this.Affection -= 1f; this.CalculateAffection(); } else if (this.Opinion == 1) { this.DialogueLabel.text = this.Negatives[this.AffectionLevel]; this.Rival.Character.GetComponent <Animation>().CrossFade("f02_lookdown_00"); this.CurrentAnim = "f02_lookdown_00"; this.Affection += (float)this.Multiplier; this.CalculateAffection(); } else if (this.Opinion == 0) { this.DialogueLabel.text = "Um...okay."; } } else { UILabel uilabel2 = this.Labels[2]; uilabel2.color = new Color(uilabel2.color.r, uilabel2.color.g, uilabel2.color.b, 0.5f); if (this.Opinion == 2) { this.DialogueLabel.text = this.Positives[this.AffectionLevel]; this.Rival.Character.GetComponent <Animation>().CrossFade("f02_lookdown_00"); this.CurrentAnim = "f02_lookdown_00"; this.Affection += (float)this.Multiplier; this.CalculateAffection(); } else if (this.Opinion == 1) { this.DialogueLabel.text = "To be honest with you, I strongly disagree..."; this.Rival.Character.GetComponent <Animation>().CrossFade("f02_refuse_00"); this.CurrentAnim = "f02_refuse_00"; this.Affection -= 1f; this.CalculateAffection(); } else if (this.Opinion == 0) { this.DialogueLabel.text = "Um...all right."; } } if (this.Affection > 100f) { this.Affection = 100f; } else if (this.Affection < 0f) { this.Affection = 0f; } } if (Input.GetButtonDown("B")) { this.SelectingTopic = false; } } else if (this.Complimenting) { this.ComplimentSet.localScale = Vector3.Lerp(this.ComplimentSet.localScale, new Vector3(1f, 1f, 1f), Time.deltaTime * 10f); if (this.InputManager.TappedUp) { this.Line--; this.UpdateComplimentHighlight(); } else if (this.InputManager.TappedDown) { this.Line++; this.UpdateComplimentHighlight(); } if (this.InputManager.TappedLeft) { this.Side--; this.UpdateComplimentHighlight(); } else if (this.InputManager.TappedRight) { this.Side++; this.UpdateComplimentHighlight(); } if (Input.GetButtonDown("A") && this.ComplimentLabels[this.ComplimentSelected].color.a == 1f) { UILabel uilabel3 = this.Labels[3]; uilabel3.color = new Color(uilabel3.color.r, uilabel3.color.g, uilabel3.color.b, 0.5f); this.Complimenting = false; this.DialogueLabel.text = this.Compliments[this.ComplimentSelected]; DatingGlobals.SetComplimentGiven(this.ComplimentSelected, true); if (this.ComplimentSelected == 1 || this.ComplimentSelected == 4 || this.ComplimentSelected == 5 || this.ComplimentSelected == 8 || this.ComplimentSelected == 9) { this.Rival.Character.GetComponent <Animation>().CrossFade("f02_lookdown_00"); this.CurrentAnim = "f02_lookdown_00"; this.Affection += (float)this.Multiplier; this.CalculateAffection(); } else { this.Rival.Character.GetComponent <Animation>().CrossFade("f02_refuse_00"); this.CurrentAnim = "f02_refuse_00"; this.Affection -= 1f; this.CalculateAffection(); } if (this.Affection > 100f) { this.Affection = 100f; } else if (this.Affection < 0f) { this.Affection = 0f; } } if (Input.GetButtonDown("B")) { this.Complimenting = false; } } else if (this.ShowingOff) { this.ShowOff.localScale = Vector3.Lerp(this.ShowOff.localScale, new Vector3(1f, 1f, 1f), Time.deltaTime * 10f); if (this.InputManager.TappedUp) { this.TraitSelected--; this.UpdateTraitHighlight(); } else if (this.InputManager.TappedDown) { this.TraitSelected++; this.UpdateTraitHighlight(); } if (Input.GetButtonDown("A")) { UILabel uilabel4 = this.Labels[4]; uilabel4.color = new Color(uilabel4.color.r, uilabel4.color.g, uilabel4.color.b, 0.5f); this.ShowingOff = false; if (this.TraitSelected == 2) { if (DatingGlobals.GetSuitorTrait(2) > DatingGlobals.GetTraitDemonstrated(2)) { DatingGlobals.SetTraitDemonstrated(2, DatingGlobals.GetTraitDemonstrated(2) + 1); this.DialogueLabel.text = this.ShowOffs[this.AffectionLevel]; this.Rival.Character.GetComponent <Animation>().CrossFade("f02_lookdown_00"); this.CurrentAnim = "f02_lookdown_00"; this.Affection += (float)this.Multiplier; this.CalculateAffection(); } else { this.DialogueLabel.text = "Uh...you already told me about that..."; } } else { this.DialogueLabel.text = "Um...well...that sort of thing doesn't really matter to me..."; } if (this.Affection > 100f) { this.Affection = 100f; } else if (this.Affection < 0f) { this.Affection = 0f; } } if (Input.GetButtonDown("B")) { this.ShowingOff = false; } } else if (this.GivingGift) { this.GiveGift.localScale = Vector3.Lerp(this.GiveGift.localScale, new Vector3(1f, 1f, 1f), Time.deltaTime * 10f); if (this.InputManager.TappedUp) { this.GiftRow--; this.UpdateGiftHighlight(); } else if (this.InputManager.TappedDown) { this.GiftRow++; this.UpdateGiftHighlight(); } if (this.InputManager.TappedLeft) { this.GiftColumn--; this.UpdateGiftHighlight(); } else if (this.InputManager.TappedRight) { this.GiftColumn++; this.UpdateGiftHighlight(); } if (Input.GetButtonDown("A")) { if (this.GiftSelected == 1 && this.RoseIcon.enabled) { UILabel uilabel5 = this.Labels[5]; uilabel5.color = new Color(uilabel5.color.r, uilabel5.color.g, uilabel5.color.b, 0.5f); this.GivingGift = false; this.DialogueLabel.text = this.GiveGifts[this.AffectionLevel]; this.Rival.Character.GetComponent <Animation>().CrossFade("f02_lookdown_00"); this.CurrentAnim = "f02_lookdown_00"; this.Affection += (float)this.Multiplier; this.CalculateAffection(); } if (this.Affection > 100f) { this.Affection = 100f; } else if (this.Affection < 0f) { this.Affection = 0f; } } if (Input.GetButtonDown("B")) { this.GivingGift = false; } } } else if (this.Phase == 5) { this.Speed += Time.deltaTime * 100f; this.AffectionSet.localPosition = new Vector3(this.AffectionSet.localPosition.x, this.AffectionSet.localPosition.y + this.Speed, this.AffectionSet.localPosition.z); this.OptionSet.localPosition = new Vector3(this.OptionSet.localPosition.x + this.Speed, this.OptionSet.localPosition.y, this.OptionSet.localPosition.z); if (this.Speed > 100f && Input.GetButtonDown("A")) { this.Phase++; } } else if (this.Phase == 6) { this.DatingSimHUD.alpha = Mathf.MoveTowards(this.DatingSimHUD.alpha, 0f, Time.deltaTime); if (this.DatingSimHUD.alpha == 0f) { this.DatingSimHUD.gameObject.SetActive(false); this.Phase++; } } else if (this.Phase == 7) { if (this.Panel.alpha == 0f) { this.LoveManager.RivalWaiting = false; this.LoveManager.Courted = true; this.Suitor.enabled = true; this.Rival.enabled = true; this.Suitor.CurrentDestination = this.Suitor.Destinations[this.Suitor.Phase]; this.Suitor.Pathfinding.target = this.Suitor.Destinations[this.Suitor.Phase]; this.Suitor.Prompt.Label[0].text = " Talk"; this.Suitor.Pathfinding.canSearch = true; this.Suitor.Pathfinding.canMove = true; this.Suitor.Pushable = false; this.Suitor.Meeting = false; this.Suitor.Routine = true; this.Suitor.MeetTimer = 0f; this.Rival.Cosmetic.MyRenderer.materials[2].SetFloat("_BlendAmount", 0f); this.Rival.CurrentDestination = this.Rival.Destinations[this.Rival.Phase]; this.Rival.Pathfinding.target = this.Rival.Destinations[this.Rival.Phase]; this.Rival.CharacterAnimation["f02_smile_00"].weight = 0f; this.Rival.Prompt.Label[0].text = " Talk"; this.Rival.Pathfinding.canSearch = true; this.Rival.Pathfinding.canMove = true; this.Rival.Pushable = false; this.Rival.Meeting = false; this.Rival.Routine = true; this.Rival.MeetTimer = 0f; this.StudentManager.Clock.StopTime = false; this.Yandere.RPGCamera.enabled = true; this.Suitor.Earpiece.SetActive(false); this.HeartbeatCamera.SetActive(true); this.Yandere.Headset.SetActive(false); DatingGlobals.Affection = this.Affection; this.PromptBar.ClearButtons(); this.PromptBar.Show = false; } else if (this.Panel.alpha == 1f) { this.Matchmaking = false; this.Yandere.CanMove = true; base.gameObject.SetActive(false); } this.Panel.alpha = Mathf.MoveTowards(this.Panel.alpha, 1f, Time.deltaTime); } } }
public void Show(string text, float width = 0) { Transform child; for (int i = 0; i < transform.childCount; i++) { child = transform.GetChild(i); if (child.name == "Icon(Clone)") { Destroy(child.gameObject); } } if (label == null) { label = gameObject.GetComponent <UILabel>(); } if (spriteIcon == null) { spriteIcon = gameObject.transform.Find("Icon").gameObject.GetComponent <UISprite>(); } label.text = ""; label.UpdateNGUIText(); per_height = label.height; cur_height = per_height; cur_width = 0; if (e_list == null) { e_list = new List <IconData>(); } m_curIndex = 0; max_width = width; System.Text.StringBuilder _sb = LuaInterface.StringBuilderCache.Acquire(); float ch_width = 0.0f; int length = text.Length; int n = 0, m = 0; float space_width = NGUIText.CalculatePrintedSize(" ").x; int lengthIcon = 0; if (spriteIcon != null) { lengthIcon = (int)Math.Ceiling(spriteIcon.localSize.x / space_width); } for (int i = 0; i < length; i++) { if (m > i) { _sb.Append(text[i]); continue; } if (n > 0) { n--; continue; } if (text[i] == '[') { int index = i; bool is_symbol = NGUIText.ParseSymbol(text, ref index); if (is_symbol) { m = index; _sb.Append(text[i]); continue; } } if (text[i] == '\n' && i + 1 <= length) { cur_width = 0; cur_height += per_height; _sb.Append("\n"); continue; } if (text[i] == '[' && text.Substring(i, 5).Equals("[img]")) { if (cur_width + 2 * space_width > max_width) { cur_height += per_height; cur_width = 0; _sb.Append("\n"); } int indexEnd = text.IndexOf("[-]", i); string eName = text.Substring(i + 5, indexEnd - i - 5); IconData e = null; bool isExpression = false; if (eName != null || eName != "") { isExpression = true; e = GetEmoticonByIndex(m_curIndex); m_curIndex++; e.eName = eName; e.pos.x = cur_width + 2; e.pos.y = -1 * cur_height; cur_width += lengthIcon * space_width; for (int j = 0; j < lengthIcon; j++) { _sb.Append(" "); } } if (!isExpression) { _sb.Append(text[i]); } else { n = indexEnd - i + 2; } } else { ch_width = NGUIText.CalculatePrintedSize(text[i].ToString()).x; cur_width += ch_width; if (cur_width > max_width) { _sb.Append("\n"); cur_height += per_height; cur_width = ch_width; } _sb.Append(text[i]); } } label.text = LuaInterface.StringBuilderCache.GetStringAndRelease(_sb);//output_str; Show_emoticon(); }
void Start() { mSprite = gameObject.GetComponent <UISprite>(); ResetSprite(); }
public MoneyBarUI(UIWindow parant) { if (parant.GetName() == "common") { return; } GameObject moneyBar = WindowManager.Instance.CloneCommonUI("MoneyBar"); if (moneyBar == null) { Debug.LogError("找不到MoneyBar"); return; } moneyBar.name = moneyBar.name.Replace("(Clone)", ""); moneyBar.gameObject.SetActive(true); moneyBar.transform.parent = parant.gameObject.transform; moneyBar.transform.localPosition = new Vector3(186f, 288f, 0f); moneyBar.transform.localScale = Vector3.one; closeBt = ObjectCommon.GetChildComponent <UIButton>(moneyBar, "returnBtn"); creditSp = ObjectCommon.GetChildComponent <UISprite>(moneyBar, "Grid/6credit/iconSp"); creditLb = ObjectCommon.GetChildComponent <UILabel>(moneyBar, "Grid/6credit/countLb"); creditBt = ObjectCommon.GetChildComponent <UIButton>(moneyBar, "Grid/6credit/btSp"); starSp = ObjectCommon.GetChildComponent <UISprite>(moneyBar, "Grid/5star/iconSp"); starLb = ObjectCommon.GetChildComponent <UILabel>(moneyBar, "Grid/5star/countLb"); starBt = ObjectCommon.GetChildComponent <UIButton>(moneyBar, "Grid/5star/btSp"); shengwangSp = ObjectCommon.GetChildComponent <UISprite>(moneyBar, "Grid/4shengwang/iconSp"); shengwangLb = ObjectCommon.GetChildComponent <UILabel>(moneyBar, "Grid/4shengwang/countLb"); shengwangBt = ObjectCommon.GetChildComponent <UIButton>(moneyBar, "Grid/4shengwang/btSp"); tiliSp = ObjectCommon.GetChildComponent <UISprite>(moneyBar, "Grid/3tili/iconSp"); tiliLb = ObjectCommon.GetChildComponent <UILabel>(moneyBar, "Grid/3tili/countLb"); tiliBt = ObjectCommon.GetChildComponent <UIButton>(moneyBar, "Grid/3tili/btSp"); coinSp = ObjectCommon.GetChildComponent <UISprite>(moneyBar, "Grid/2coin/iconSp"); coinLb = ObjectCommon.GetChildComponent <UILabel>(moneyBar, "Grid/2coin/countLb"); coinBt = ObjectCommon.GetChildComponent <UIButton>(moneyBar, "Grid/2coin/btSp"); diamondSp = ObjectCommon.GetChildComponent <UISprite>(moneyBar, "Grid/1diamond/iconSp"); diamondLb = ObjectCommon.GetChildComponent <UILabel>(moneyBar, "Grid/1diamond/countLb"); diamondBt = ObjectCommon.GetChildComponent <UIButton>(moneyBar, "Grid/1diamond/btSp"); grid = ObjectCommon.GetChildComponent <UIGrid>(moneyBar, "Grid"); mGo = moneyBar; mParant = parant; mPlayerDataModule = ModuleManager.Instance.FindModule <PlayerDataModule>(); Init(); EventDelegate.Add(closeBt.onClick, OnCloseClick); EventSystem.Instance.addEventListener(ProceedsEvent.PROCEEDS_CHANGE_ALL, UpdateMoneyInfo); EventSystem.Instance.addEventListener(PlayerDataEvent.PLAYER_DATA_CHANGED, onPlayerDataChanged); EventSystem.Instance.addEventListener(PropertyEvent.MAIN_PROPERTY_CHANGE, onPlayerDataChanged); UpdateMoney(); UpdateSpAndStar(); }
void Awake() { this.ChapterIcon = this.transform.FindChild("Image").GetComponent <UISprite>(); this.ChapterName = this.transform.FindChild("Name").GetComponent <UILabel>(); UIEventListener.Get(this.gameObject).onClick = OnSelectChapter; }
//初始化控件变量 protected override void InitControls() { fastComponent = GetComponent <FastComponent>(); fastComponent.BuildFastComponents(); m_btn_close = fastComponent.FastGetComponent <UIButton>("close"); if (null == m_btn_close) { Engine.Utility.Log.Error("m_btn_close 为空,请检查prefab是否缺乏组件"); } m_label_name = fastComponent.FastGetComponent <UILabel>("name"); if (null == m_label_name) { Engine.Utility.Log.Error("m_label_name 为空,请检查prefab是否缺乏组件"); } m_btn_btn_cancel = fastComponent.FastGetComponent <UIButton>("btn_cancel"); if (null == m_btn_btn_cancel) { Engine.Utility.Log.Error("m_btn_btn_cancel 为空,请检查prefab是否缺乏组件"); } m_btn_btn_lingwu = fastComponent.FastGetComponent <UIButton>("btn_lingwu"); if (null == m_btn_btn_lingwu) { Engine.Utility.Log.Error("m_btn_btn_lingwu 为空,请检查prefab是否缺乏组件"); } m_label_skill_effect_Label = fastComponent.FastGetComponent <UILabel>("skill_effect_Label"); if (null == m_label_skill_effect_Label) { Engine.Utility.Log.Error("m_label_skill_effect_Label 为空,请检查prefab是否缺乏组件"); } m_sprite_xiaohao_icon = fastComponent.FastGetComponent <UISprite>("xiaohao_icon"); if (null == m_sprite_xiaohao_icon) { Engine.Utility.Log.Error("m_sprite_xiaohao_icon 为空,请检查prefab是否缺乏组件"); } m_sprite_itemqua = fastComponent.FastGetComponent <UISprite>("itemqua"); if (null == m_sprite_itemqua) { Engine.Utility.Log.Error("m_sprite_itemqua 为空,请检查prefab是否缺乏组件"); } m_label_xiaohao_name = fastComponent.FastGetComponent <UILabel>("xiaohao_name"); if (null == m_label_xiaohao_name) { Engine.Utility.Log.Error("m_label_xiaohao_name 为空,请检查prefab是否缺乏组件"); } m_label_xiaohao_number = fastComponent.FastGetComponent <UILabel>("xiaohao_number"); if (null == m_label_xiaohao_number) { Engine.Utility.Log.Error("m_label_xiaohao_number 为空,请检查prefab是否缺乏组件"); } m_toggle_xiaohao_Sprite = fastComponent.FastGetComponent <UIToggle>("xiaohao_Sprite"); if (null == m_toggle_xiaohao_Sprite) { Engine.Utility.Log.Error("m_toggle_xiaohao_Sprite 为空,请检查prefab是否缺乏组件"); } m_label_xiaohao_dianjuan = fastComponent.FastGetComponent <UILabel>("xiaohao_dianjuan"); if (null == m_label_xiaohao_dianjuan) { Engine.Utility.Log.Error("m_label_xiaohao_dianjuan 为空,请检查prefab是否缺乏组件"); } if (null != fastComponent) { GameObject.Destroy(fastComponent); } }
void Start() { mUISprite = gameObject.GetComponent <UISprite>(); mUISpriteAnimation = gameObject.GetComponent <UISpriteAnimation>(); }
private void Awake() { sprite = transform.Find("Sprite").GetComponent <UISprite>(); }
void SetGameObjectInfo(UnityEngine.GameObject goc, StoreConfig sc, int remaintimes) { if (goc != null && sc != null) { ItemConfig ic = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(sc.m_ItemId); if (ic != null) { UnityEngine.Transform tf = goc.transform.Find("name"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = ic.m_ItemName; UnityEngine.Color col = new UnityEngine.Color(); switch (ic.m_PropertyRank) { case 1: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; case 2: col = new UnityEngine.Color(0x00 / 255f, 0xfb / 255f, 0x4a / 255f); break; case 3: col = new UnityEngine.Color(0x41 / 255f, 0xc0 / 255f, 0xff / 255f); break; case 4: col = new UnityEngine.Color(0xff / 255f, 0x00 / 255f, 0xff / 255f); break; case 5: col = new UnityEngine.Color(0xff / 255f, 0xa3 / 255f, 0x00 / 255f); break; default: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; } ul.color = col; } } //if (sc.m_HaveDayLimit) { DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Store_item, goc, sc.m_ItemId, sc.m_ItemNum); // } else { // DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Store_item, goc, sc.m_ItemId); // } // tf = goc.transform.Find("kuang"); // if (tf != null) { // UISprite us = tf.gameObject.GetComponent<UISprite>(); // if (us != null) { // us.spriteName = "SEquipFrame" + ic.m_PropertyRank; // } // } // tf = tf.Find("UnityEngine.Texture"); // if (tf != null) { // UITexture ut = tf.gameObject.GetComponent<UITexture>(); // if (ut != null) { // UnityEngine.Texture tt = GamePokeyManager.GetTextureByPicName(ic.m_ItemTrueName); // if (tt != null) { // ut.mainTexture = tt; // } // } // } //// tf = goc.transform.Find("kuang/number"); //// if (tf != null) { //// UILabel ul = tf.gameObject.GetComponent<UILabel>(); //// if (ul != null) { //// ul.text = sc.m_ItemNum.ToString(); //// } //// } // tf = goc.transform.Find("kuang/Limit"); // if (tf != null) { // UILabel ul = tf.gameObject.GetComponent<UILabel>(); // if (ul != null) { //if (sc.m_HaveDayLimit) { // ul.text = "" + remaintimes/* + "/" + sc.m_DayLimit*/; //} else { // ul.text = "" /*+ ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(1004)*/; //} // } // } tf = goc.transform.Find("Price/Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { int price = 0; if (sc.m_HaveDayLimit) { if (sc.m_Price.Count > (sc.m_DayLimit - remaintimes)) { price = sc.m_Price[sc.m_DayLimit - remaintimes]; } if (sc.m_Price.Count == (sc.m_DayLimit - remaintimes)) { price = sc.m_Price[sc.m_Price.Count - 1]; } } else { price = sc.m_Price[0]; } ul.text = price.ToString(); if (lastcurrency < price) { ul.color = UnityEngine.Color.red; } else { ul.color = new UnityEngine.Color(131 / 255f, 67 / 255f, 0f); } } } tf = goc.transform.Find("SellOut"); if (tf != null) { if (sc.m_HaveDayLimit && remaintimes <= 0) { NGUITools.SetActive(tf.gameObject, true); } else { NGUITools.SetActive(tf.gameObject, false); } } tf = goc.transform.Find("Matte"); if (tf != null) { if (sc.m_HaveDayLimit && remaintimes <= 0) { NGUITools.SetActive(tf.gameObject, true); } else { NGUITools.SetActive(tf.gameObject, false); } } tf = goc.transform.Find("Price/Currency"); if (tf != null) { UISprite us = tf.gameObject.GetComponent <UISprite>(); if (us != null) { us.spriteName = currencySprite; } } } } }