private void StartLoadingTexture() { if (!string.IsNullOrEmpty(textureUrl)) { _uiTexture = gameObject.GetComponent<UITexture>(); if (!_uiTexture) { _uiTexture = gameObject.AddComponent<UITexture>(); //Material mat = new Material(Shader.Find("Unlit/Transparent Colored (AlphaClip)")); Material mat = new Material(Shader.Find("Unlit/Transparent Colored")); _uiTexture.material = mat; } _uiTexture.MakePixelPerfect(); this.LoadTexture(textureUrl, (texture) => { _uiTexture.mainTexture = texture; _uiTexture.MakePixelPerfect(); if ((hack_x>0) && (hack_y>0)) { gameObject.transform.localScale = new Vector3 (hack_x, hack_y, gameObject.transform.localScale.z); } /* Scale images if not retina */ /* if (!AppGUISettings.IS_RETINA) gameObject.transform.localScale = new Vector3 (gameObject.transform.localScale.x/2, gameObject.transform.localScale.y/2, gameObject.transform.localScale.z); */ }); } }
void Awake() { myLabel = GetComponent<UILabel>(); daddy = transform.parent.gameObject; myBackground = transform.parent.Find("Background").GetComponent<UITexture>(); }
void Start () { mTrans = transform; mUITex = GetComponent<UITexture>(); mCam = UICamera.FindCameraForLayer(gameObject.layer); mWidth = mUITex.width; mHeight = mUITex.height; Color[] cols = new Color[mWidth * mHeight]; for (int y = 0; y < mHeight; ++y) { float fy = (y - 1f) / mHeight; for (int x = 0; x < mWidth; ++x) { float fx = (x - 1f) / mWidth; int index = x + y * mWidth; cols[index] = Sample(fx, fy); } } mTex = new Texture2D(mWidth, mHeight, TextureFormat.RGB24, false); mTex.SetPixels(cols); mTex.filterMode = FilterMode.Trilinear; mTex.wrapMode = TextureWrapMode.Clamp; mTex.Apply(); mUITex.mainTexture = mTex; Select(value); }
public void Init(bool shouldScroll = false, bool shouldGrey = false) { GameObject gameObject = base.transform.Find("activeSkill").gameObject; this.mActiveSkill = gameObject.transform.Find("skill").GetComponent<UITexture>(); UIEventListener expr_41 = UIEventListener.Get(this.mActiveSkill.gameObject); expr_41.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(expr_41.onPress, new UIEventListener.BoolDelegate(this.OnSkillIconPress)); for (int i = 0; i < 3; i++) { this.mPassiveSkills[i] = base.transform.Find(string.Format("passiveSkill{0}", i)).gameObject; this.mPassiveSkillIcons[i] = this.mPassiveSkills[i].transform.Find("skill").GetComponent<UISprite>(); UIEventListener expr_C7 = UIEventListener.Get(this.mPassiveSkillIcons[i].gameObject); expr_C7.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(expr_C7.onPress, new UIEventListener.BoolDelegate(this.OnPassiveSkillIconPress)); this.mPassiveSkillIconGreys[i] = this.mPassiveSkills[i].transform.Find("skillGrey").GetComponent<UISprite>(); UIEventListener expr_11E = UIEventListener.Get(this.mPassiveSkillIconGreys[i].gameObject); expr_11E.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(expr_11E.onPress, new UIEventListener.BoolDelegate(this.OnPassiveSkillIconPress)); } if (shouldScroll) { this.mActiveSkill.gameObject.AddComponent<UIDragScrollView>(); for (int j = 0; j < 3; j++) { this.mPassiveSkillIcons[j].gameObject.AddComponent<UIDragScrollView>(); this.mPassiveSkillIconGreys[j].gameObject.AddComponent<UIDragScrollView>(); } } if (shouldGrey) { for (int k = 0; k < 3; k++) { this.mPassiveSkillIconGreys[k].color = Color.black; } } }
void Awake() { m_instance = gameObject.GetComponent<DiamondToGoldUIViewManager>(); m_myTransform = transform; FillFullNameData(m_myTransform); m_lblDiamondToGoldUIFromDiamondText2 = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIFromDiamondText2"]).GetComponent<UILabel>(); m_lblDiamondToGoldUIToGoldText2 = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIToGoldText2"]).GetComponent<UILabel>(); m_lblDiamondToGoldUILastTimesText2 = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUILastTimesText2"]).GetComponent<UILabel>(); m_tranGODiamondToGoldChoose = m_myTransform.FindChild(m_widgetToFullName["GODiamondToGoldChoose"]); m_lblDiamondToGoldUIUseAllText1 = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIUseAllText1"]).GetComponent<UILabel>(); m_texDiamondToGoldUIBtnTurnBG = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIBtnTurnBG"]).GetComponent<UITexture>(); m_goDiamondToGoldUIUseOKCancel = m_myTransform.FindChild(m_widgetToFullName["GODiamondToGoldUIUseOKCancel"]).gameObject; m_lblDiamondToGoldUIUseInfoDiamondText2 = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIUseInfoDiamondText2"]).GetComponent<UILabel>(); m_lblDiamondToGoldUIUseInfoGoldText2 = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIUseInfoGoldText2"]).GetComponent<UILabel>(); m_goDiamondToGoldUIUseTipEnable = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIUseTipEnable"]).gameObject; m_goGODiamondToGoldUIUseTipEnable = m_myTransform.FindChild(m_widgetToFullName["GODiamondToGoldUIUseTipEnable"]).gameObject; m_goDiamondToGoldUIUseTipEnableBGDown = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIUseTipEnableBGDown"]).gameObject; m_goDiamondToGoldUIUseAllCheckDown = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIUseAllCheckDown"]).gameObject; m_goDiamondToGoldUIUseOneCheckDown = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIUseOneCheckDown"]).gameObject; m_lblDiamondToGoldUIDiamondNum = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIDiamondNum"]).GetComponentsInChildren<UILabel>(true)[0]; m_lblDiamondToGoldUIGoldNum = m_myTransform.FindChild(m_widgetToFullName["DiamondToGoldUIGoldNum"]).GetComponentsInChildren<UILabel>(true)[0]; IsShowGoldMetallurgyTipDialog = SystemConfig.Instance.IsShowGoldMetallurgyTipDialog; Initialize(); }
private void Start() { texture = gameObject.GetComponent<UITexture>(); speedEnd = texture.gc.speedControl; texture.gc.speedControl = 0; revive = PlayerPrefs.GetInt("Revive"); _start = true; }
/// <summary> /// Sets the components. /// </summary> /// <param name='_sprite'> /// _sprite. /// </param> /// <param name='_stretch'> /// _stretch. /// </param> public void SetComponents(UITexture _texture, UIStretch _stretch) { texture = _texture; transform = texture.transform; stretch = _stretch; }
public void Start() { name = gameObject.name; if(GetComponentInChildren<Transform>()) backGroundChildren = GetComponentInChildren<UITexture>(); //Buttons.Instance.AddButton(this); }
void Awake() { tex = transform.GetComponentsInChildren<UITexture>(true)[0]; ta = transform.GetComponentsInChildren<TweenAlpha>(true)[0]; GetComponentsInChildren<UIFXUnit>(true)[0].UIFXPlayFuncWithFloat = Play; GetComponentsInChildren<UIFXUnit>(true)[0].UIFXStopFuncWithFloat = Stop; }
public void InitWithBaseScene(GameObject go) { this.mModelTexture = base.transform.GetComponent<UITexture>(); this.CreateRenderTexture(); this.CreateRenderCamera(go); this.mModelTexture.shader = Shader.Find("Unlit/Transparent Colored"); this.mModelTexture.mainTexture = this.mRenderTexture; }
// Use this for initialization void Start () { TextureSize = MoveTexture.Length; MoveMaxTick = TextureSize; UT = GetComponent<UITexture>(); // BaseShader = UT.shader; }
void Start () { if (this.uiTexture != null) this.uiTexture = this.GetComponent<UITexture> (); if (this.textureList.Count == 0) Debug.Log(this.gameObject.name+"のTextureAnimation-textureListに画像が設定されていません。"); }
void Start() { //movSpeed = startMovSpeed; myTexture = GetComponent<UITexture>(); initalTextureY = myTexture.uvRect.y; manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<Selfish_Sam_Manager>(); //movSpeed -= movSpeed * manager.verticalSpeedIncrease; }
public void Init() { GameObject parent = GameUITools.FindGameObject("skills", base.gameObject); this.mActive = GameUITools.FindGameObject("active", parent); this.mActiveSkill = GameUITools.FindGameObject("skill", this.mActive).GetComponent<UITexture>(); UIEventListener expr_4D = UIEventListener.Get(this.mActiveSkill.gameObject); expr_4D.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(expr_4D.onPress, new UIEventListener.BoolDelegate(this.OnSkillIconPress)); }
public void FindObjects () { mStageManager = GetComponentInParent<StageManager> (); mIdolStageStatusManager = GetComponentInChildren<IdolStageStatusManager> (); mBackgroundTexture = GetComponentInChildren<UITexture> (); mSkipConstructionButtonObject = transform.FindChild ("SkipConstructionButton").gameObject; mSleepObject = transform.FindChild ("Sleep").gameObject; mIdolStageStatusManager.FindObjects (); }
public override void Awake() { base.Awake(); _uiTexture = gameObject.GetComponent<UITexture>(); width = transform.localScale.x; height = transform.localScale.y; }
void Start() { MuzzleyAppController.OnReady += OnMuzzleyAppReady; loadingbar = GameObject.Find("foreground").GetComponent<UISprite>(); loadingbar.transform.localScale = new Vector3(0, loadingbar.transform.localScale.y, loadingbar.transform.localScale.z); qrcode = GameObject.Find("QrCode").GetComponent<UITexture>(); qrcode.enabled = false; }
// Use this for initialization void Awake() { if ( m_Texture == null ){ m_Texture = gameObject.GetComponent<UITexture>(); } if (m_Texture == null ){ Debug.LogError("No Texture Found!!"); } }
protected override void OnEnableLate() { uiTexture = GetComponent<UITexture>(); if (uiTexture == null) { Debug.LogError("Can not find UITexture."); Destroy(this); } }
// Use this for initialization void Awake() { uiTexture = transform.GetComponent<UITexture>(); PurpleSandClock = (MovieTexture)Resources.Load("shalou"); GreenSandClock = (MovieTexture)Resources.Load("shalougreen"); SandClockTurning = (MovieTexture)Resources.Load("shalouxuan"); EnergyManager.Instance.StartTurn += this.StartTurn; EnergyManager.Instance.TurnsEnd += this.TurnsEnd; uiTexture.mainTexture = null; }
public void AddNewUserStar(bool flash, int at) { UITexture newCellTexture = userStarsGridOb.transform.GetChild (at).GetComponent<UITexture> (); newCellTexture.mainTexture = userStarImg; userStarsGridOb.GetComponent<UIGrid> ().Reposition (); if (flash) { toFlash = newCellTexture; StartCoroutine ("Flash"); } }
public void SetSelectColor(bool isCenter) { if (mTexture == null) mTexture = this.GetComponent<UITexture>(); if (isCenter) mTexture.color = Color.white; else mTexture.color = Color.gray; }
private IEnumerator LoadProfilePicture(FacebookFriend friend, UITexture texture) { Debug.Log("Getting profile picture for friend " + friend.name); Texture profilePicture = null; yield return StartCoroutine(friend.GetProfilePicture(value => profilePicture = value)); Debug.Log("Finished loading profile picture for friend " + friend.name); texture.mainTexture = profilePicture; }
private IEnumerator PrepareForNext() { Front.transform.localPosition -= 2 * offset; var t = Front; Front = Back; Back = t; backIndex = GetIndex(backIndex + 1); Back.mainTexture = Textures[backIndex]; yield return new WaitForSeconds(IntervalTime); Play(); }
private void CreateObjects() { this.mBgTt = base.transform.GetComponent<UITexture>(); for (int i = 0; i < 5; i++) { this.mLeafItems[i] = base.transform.Find(string.Format("l{0}", i)).gameObject.AddComponent<GUITrailBranchLeafItem>(); this.mLeafItems[i].InitWithBaseScene(this.mBaseScene, i); } this.mBottom = base.transform.Find("bottom").gameObject; this.mBottom.SetActive(false); }
public void SetAsyncImage(string url,UITexture texture,Action callback = null) { texture.mainTexture = placeholder; if (!File.Exists(path + url.GetHashCode())) { StartCoroutine(DownloadImage(url, texture, callback)); } else { StartCoroutine(LoadLocalImage(url, texture, callback)); } }
IEnumerator load() { bg = NGUITools.AddWidget<UITexture>(gameObject); string url = "file://" + Application.dataPath + "/elements/unit/trrain/0.jpg"; //Debug.Log("文件路径" + url); WWW www = new WWW(url); yield return www; mMat = new Material(Shader.Find("Unlit/Transparent Colored")); bg.material = mMat; mMat.mainTexture = www.texture; //bg.MakePixelPerfect(); }
//读取网络资源 IEnumerator LoadLocalImage(string url, UITexture texture, Action callback = null) { string filePath = "file:///" + path + url.GetHashCode(); Debug.Log("getting local image:" + filePath); WWW www = new WWW(filePath); yield return www; texture.mainTexture = www.texture; SetOtherOperations(); if (callback != null) callback(); }
public void SetTexture(UITexture txt){ if (null == txt.mainTexture) { mainImage.mainTexture = PlaceholderImageManager.Instance.GetRandomImage ((int)Nid) as Texture2D; } else { mainImage.mainTexture = Instantiate (txt.mainTexture) as Texture2D; } mainImage.transform.position = txt.transform.position; mainImage.transform.localScale = new Vector3 ((txt.localSize.x / Screen.height), // active screen width (txt.localSize.y / Screen.height), // active screen height (0f) ); }
// Use this for initialization IEnumerator Start () { uiTexture = GetComponent<UITexture>(); if(uiTexture == null || uiTexture.material == null) { Debug.LogWarning("Could not find UITexture or material"); enabled = false; yield break; } //wait two frames so we know drawCall exists yield return null; yield return null; barMaterial = uiTexture.drawCall.dynamicMaterial; }
protected virtual void OnDestroy() { this._uiShipTex = null; this._clsIShipModel = null; this.OnUnInit(); }
void Awake() { selfTexture = GetComponent <UITexture>(); }
public void LoadLocalImage(string file, UITexture texture) { StartCoroutine(_LoadLocal(file, texture)); }
public void OnLoadPhoto(UITexture tex, string name, ZFrame.Asset.DelegateObjectLoaded onLoaded) { StartCoroutine(LoadTexture(tex, name, onLoaded)); }
void Start() { lobbyManager = GameObject.Find("LobbyManager").GetComponent <LobbyManager>(); mLabel = GameObject.Find("Champion_Name_Label").GetComponent <UILabel>(); mTexture = GameObject.Find("Champion_Portrait").GetComponent <UITexture>(); }
public void map_status() { uiStageCovers = GameObject.Find("board2nd/board1/page1/UIStageCovers").GetComponentsInChildren <UIStageCover>(); MapAreaModel areaModel = StrategyTopTaskManager.Instance.TileManager.FocusTile.GetAreaModel(); MapModel[] maps = StrategyTopTaskManager.GetLogicManager().SelectArea(areaModel.Id).Maps; UILabel component = GameObject.Find("board2nd/board1/page1/Labels/Label_0-1").GetComponent <UILabel>(); component.text = Util.getDifficultyString(strategyLogicManager.UserInfo.Difficulty); UILabel component2 = GameObject.Find("board2nd/board1/page1/Labels/Label_1-2").GetComponent <UILabel>(); component2.text = areaModel.Name; UILabel component3 = GameObject.Find("board2nd/board1/page2/Labels/Label_2-4").GetComponent <UILabel>(); component3.supportEncoding = false; if (areaModel.Id < 15) { string name = areaModel.GetEscortDeck().Name; if (name.Replace(" ", string.Empty).Replace("\u3000", string.Empty).Length != 0) { component3.text = name; } else { component3.text = areaModel.Name.Replace("海域", string.Empty) + "航路護衛隊"; } } else { component3.text = "---"; } GameObject.Find("board2nd/board1/page2/Decks").transform.localPosition = new Vector3(-17.536f * (float)strategyLogicManager.UserInfo.DeckCount + 94.286f, 0f); for (int i = 0; i < 8; i++) { UISprite component4 = GameObject.Find("board2nd/board1/page2/Decks/Deck" + (i + 1).ToString()).GetComponent <UISprite>(); component4.color = Color.black; if (i < strategyLogicManager.UserInfo.DeckCount) { component4.transform.localScale = Vector3.one; } else { component4.transform.localScale = Vector3.zero; } } for (int j = 0; j < areaModel.GetDecks().Length; j++) { UISprite component4 = GameObject.Find("board2nd/board1/page2/Decks/Deck" + areaModel.GetDecks()[j].Id).GetComponent <UISprite>(); if (areaModel.GetDecks()[j].GetShipCount() != 0) { if (areaModel.GetDecks()[j].IsActionEnd()) { component4.color = _Color_dock * 0.75f; } else if (areaModel.GetDecks()[j].MissionState != 0) { component4.color = Color.blue; } else { component4.color = _Color_dock; } } } if (maps.Length < 5) { UILabel component5 = GameObject.Find("board2nd/board1/page1/Labels/Label_1-2").GetComponent <UILabel>(); component5.transform.localPosition = new Vector3(160f, 160f, 0f); component5.fontSize = 36; UILabel component6 = GameObject.Find("board2nd/board1/page1/Labels/Label_1-1").GetComponent <UILabel>(); component6.transform.localPosition = new Vector3(160f, 105f, 0f); component6.fontSize = 32; UILabel component7 = GameObject.Find("board2nd/board1/page1/Labels/Label_0-0").GetComponent <UILabel>(); component7.transform.localPosition = new Vector3(329f, 105f, 0f); component7.fontSize = 20; UILabel component8 = GameObject.Find("board2nd/board1/page1/Labels/Label_0-1").GetComponent <UILabel>(); component8.transform.localPosition = new Vector3(413f, 105f, 0f); component8.fontSize = 20; UITexture component9 = GameObject.Find("board2nd/board1/page1/lines/line_1").GetComponent <UITexture>(); if (component9 != null) { component9.transform.localPosition = new Vector3(160f, 103f, 0f); component9.width = 556; component9.height = 2; } for (int k = 0; k < 3; k++) { for (int l = 0; l < 2; l++) { int num = k * 2 + l + 1; GameObject gameObject = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover" + num.ToString()); if (gameObject == null) { break; } gameObject.transform.localScale = Vector3.one * 0.6f; if (num < 5) { gameObject.transform.localPosition = new Vector3(18f + 293f * (float)l, -17f - 158f * (float)k, 0f); } else { gameObject.transform.localPosition = new Vector3(18f + 293f * (float)l, 320f, 0f); } } } if (maps.Length == 3) { GameObject gameObject2 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover4"); gameObject2.transform.localScale = Vector3.zero; GameObject gameObject3 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover3"); gameObject3.transform.localPosition = new Vector3(160f, -175f); } else if (maps.Length == 4) { GameObject gameObject4 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover4"); gameObject4.transform.localScale = Vector3.one * 0.6f; GameObject gameObject5 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover3"); gameObject5.transform.localPosition = new Vector3(18f, -175f); } } else { component2.transform.localPosition = new Vector3(160f, 171f, 0f); component2.fontSize = 28; UILabel component10 = GameObject.Find("board2nd/board1/page1/Labels/Label_1-1").GetComponent <UILabel>(); component10.transform.localPosition = new Vector3(160f, 139f, 0f); component10.fontSize = 24; UILabel component11 = GameObject.Find("board2nd/board1/page1/Labels/Label_0-0").GetComponent <UILabel>(); component11.transform.localPosition = new Vector3(329f, 149f, 0f); component11.fontSize = 20; component.transform.localPosition = new Vector3(413f, 149f, 0f); component.fontSize = 20; UITexture component12 = GameObject.Find("board2nd/board1/page1/lines/line_1").GetComponent <UITexture>(); component12.transform.localPosition = new Vector3(160f, 143f, 0f); component12.width = 556; component12.height = 2; for (int m = 0; m < 3; m++) { for (int n = 0; n < 2; n++) { GameObject gameObject6 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover" + (m * 2 + n + 1).ToString()); gameObject6.transform.localScale = Vector3.one * 0.5f; gameObject6.transform.localPosition = new Vector3(12f + 299f * (float)n, 40f - 122f * (float)m, 0f); } } if (maps.Length == 5) { GameObject gameObject7 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover5"); gameObject7.transform.localPosition = new Vector3(162f, -209f, 0f); GameObject gameObject8 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover6"); gameObject8.transform.localPosition = new Vector3(162f, 320f, 0f); } } for (int num2 = 0; num2 < maps.Length; num2++) { UIStageCover component13 = GameObject.Find("board2nd/board1/page1/UIStageCovers/UIStageCover" + (num2 + 1)).GetComponent <UIStageCover>(); MapModel mapModel = maps[num2]; component13.Initialize(mapModel); } }
protected override JSONObject ToJSON(WXHierarchyContext context) { JSONObject json = new JSONObject(JSONObject.Type.OBJECT); UIPanel uiPanel = _gameObject.GetComponent(typeof(UIPanel)) as UIPanel; if ((UnityEngine.Object)uiPanel != (UnityEngine.Object)null) { size[0] = uiPanel.width; size[1] = uiPanel.height; } UIWidget uiWidget = _gameObject.GetComponent(typeof(UIWidget)) as UIWidget; if ((UnityEngine.Object)uiWidget != (UnityEngine.Object)null) { size[0] = uiWidget.width; size[1] = uiWidget.height; WXUIWidget.changeTransform(uiWidget, this); } UISprite uiSprite = _gameObject.GetComponent(typeof(UISprite)) as UISprite; if ((UnityEngine.Object)uiSprite != (UnityEngine.Object)null) { size[0] = uiSprite.width; size[1] = uiSprite.height; // finish by roamye 2019.3.25 anchor[0] = ( uiSprite.pivot == UIWidget.Pivot.Left || uiSprite.pivot == UIWidget.Pivot.TopLeft || uiSprite.pivot == UIWidget.Pivot.BottomLeft ) ? 0.0f : (( uiSprite.pivot == UIWidget.Pivot.Center || uiSprite.pivot == UIWidget.Pivot.Top || uiSprite.pivot == UIWidget.Pivot.Bottom) ? 0.5f : 1.0f); anchor[1] = ( uiSprite.pivot == UIWidget.Pivot.Bottom || uiSprite.pivot == UIWidget.Pivot.BottomLeft || uiSprite.pivot == UIWidget.Pivot.BottomRight ) ? 0.0f : (( uiSprite.pivot == UIWidget.Pivot.Left || uiSprite.pivot == UIWidget.Pivot.Center || uiSprite.pivot == UIWidget.Pivot.Right) ? 0.5f : 1.0f); } UITexture uiTexture = _gameObject.GetComponent(typeof(UITexture)) as UITexture; if ((UnityEngine.Object)uiTexture != (UnityEngine.Object)null) { size[0] = uiTexture.width; size[1] = uiTexture.height; // finish by roamye 2019.3.25 anchor[0] = ( uiTexture.pivot == UIWidget.Pivot.Left || uiTexture.pivot == UIWidget.Pivot.TopLeft || uiTexture.pivot == UIWidget.Pivot.BottomLeft ) ? 0.0f : (( uiTexture.pivot == UIWidget.Pivot.Center || uiTexture.pivot == UIWidget.Pivot.Top || uiTexture.pivot == UIWidget.Pivot.Bottom) ? 0.5f : 1.0f); anchor[1] = ( uiTexture.pivot == UIWidget.Pivot.Bottom || uiTexture.pivot == UIWidget.Pivot.BottomLeft || uiTexture.pivot == UIWidget.Pivot.BottomRight ) ? 0.0f : (( uiTexture.pivot == UIWidget.Pivot.Left || uiTexture.pivot == UIWidget.Pivot.Center || uiTexture.pivot == UIWidget.Pivot.Right) ? 0.5f : 1.0f); } UILabel uiLabel = _gameObject.GetComponent(typeof(UILabel)) as UILabel; if ((UnityEngine.Object)uiLabel != (UnityEngine.Object)null) { size[0] = uiLabel.width; size[1] = uiLabel.height; // TODO anchor // finish by roamye 2019.3.25 anchor[0] = ( uiLabel.pivot == UIWidget.Pivot.Left || uiLabel.pivot == UIWidget.Pivot.TopLeft || uiLabel.pivot == UIWidget.Pivot.BottomLeft ) ? 0.0f : (( uiLabel.pivot == UIWidget.Pivot.Center || uiLabel.pivot == UIWidget.Pivot.Top || uiLabel.pivot == UIWidget.Pivot.Bottom) ? 0.5f : 1.0f); anchor[1] = ( uiLabel.pivot == UIWidget.Pivot.Bottom || uiLabel.pivot == UIWidget.Pivot.BottomLeft || uiLabel.pivot == UIWidget.Pivot.BottomRight ) ? 0.0f : (( uiLabel.pivot == UIWidget.Pivot.Left || uiLabel.pivot == UIWidget.Pivot.Center || uiLabel.pivot == UIWidget.Pivot.Right) ? 0.5f : 1.0f); } UITable uiTable = _gameObject.GetComponent(typeof(UITable)) as UITable; if (uiTable != null) { var contentPivotValue = WXUtility.TryGetContainField(uiTable, "pivot"); if (contentPivotValue != null) { UIWidget.Pivot tableContentPivot = (UIWidget.Pivot)contentPivotValue; anchor[0] = ( tableContentPivot == UIWidget.Pivot.Left || tableContentPivot == UIWidget.Pivot.TopLeft || tableContentPivot == UIWidget.Pivot.BottomLeft ) ? 0.0f : (( tableContentPivot == UIWidget.Pivot.Center || tableContentPivot == UIWidget.Pivot.Top || tableContentPivot == UIWidget.Pivot.Bottom) ? 0.5f : 1.0f); anchor[1] = ( tableContentPivot == UIWidget.Pivot.Bottom || tableContentPivot == UIWidget.Pivot.BottomLeft || tableContentPivot == UIWidget.Pivot.BottomRight ) ? 0.0f : (( tableContentPivot == UIWidget.Pivot.Left || tableContentPivot == UIWidget.Pivot.Center || tableContentPivot == UIWidget.Pivot.Right) ? 0.5f : 1.0f); } } UIGrid uiGrid = _gameObject.GetComponent(typeof(UIGrid)) as UIGrid; if (uiGrid != null) { int entityChildrenCount = _gameObject.transform.childCount; if ((int)uiGrid.arrangement == 0) // Horizontal { size[0] = uiGrid.maxPerLine * uiGrid.cellWidth == 0 ? entityChildrenCount * uiGrid.cellWidth : uiGrid.maxPerLine * uiGrid.cellWidth; size[1] = uiGrid.maxPerLine == 0 ? uiGrid.cellHeight : uiGrid.cellHeight * ((entityChildrenCount - entityChildrenCount % uiGrid.maxPerLine) / uiGrid.maxPerLine + entityChildrenCount % uiGrid.maxPerLine); } else if ((int)uiGrid.arrangement == 1) // Vertical { size[0] = uiGrid.maxPerLine == 0 ? uiGrid.cellWidth : uiGrid.cellWidth * ((entityChildrenCount - entityChildrenCount % uiGrid.maxPerLine) / uiGrid.maxPerLine + entityChildrenCount % uiGrid.maxPerLine); size[1] = uiGrid.maxPerLine * uiGrid.cellHeight == 0 ? entityChildrenCount * uiGrid.cellHeight : uiGrid.maxPerLine * uiGrid.cellHeight; } UIWidget.Pivot contentPivot = uiGrid.pivot; anchor[0] = ( contentPivot == UIWidget.Pivot.Left || contentPivot == UIWidget.Pivot.TopLeft || contentPivot == UIWidget.Pivot.BottomLeft ) ? 0.0f : (( contentPivot == UIWidget.Pivot.Center || contentPivot == UIWidget.Pivot.Top || contentPivot == UIWidget.Pivot.Bottom) ? 0.5f : 1.0f); anchor[1] = ( contentPivot == UIWidget.Pivot.Bottom || contentPivot == UIWidget.Pivot.BottomLeft || contentPivot == UIWidget.Pivot.BottomRight ) ? 0.0f : (( contentPivot == UIWidget.Pivot.Left || contentPivot == UIWidget.Pivot.Center || contentPivot == UIWidget.Pivot.Right) ? 0.5f : 1.0f); } if (_gameObject.GetComponent(typeof(UIRoot)) != null) { size[0] = 0; size[1] = 0; transformPositionX = 0; transformPositionY = 0; transformScaleX = 1; transformScaleY = 1; transformRotation = 0; } // 位置信息 JSONObject position = new JSONObject(JSONObject.Type.ARRAY); position.Add(transformPositionX); position.Add(transformPositionY); // 缩放信息 JSONObject scale = new JSONObject(JSONObject.Type.ARRAY); scale.Add(transformScaleX); scale.Add(transformScaleY); JSONObject sizeArray = new JSONObject(JSONObject.Type.ARRAY); //Debug.Log(size[0] + ":" + size[1]); sizeArray.Add(size[0]); sizeArray.Add(size[1]); JSONObject anchorArray = new JSONObject(JSONObject.Type.ARRAY); anchorArray.Add(anchor[0]); // 0.5 anchorArray.Add(anchor[1]); // 0.5 json.AddField("type", this.getTypeName()); JSONObject subJSON = new JSONObject(JSONObject.Type.OBJECT); subJSON.AddField("position", position); subJSON.AddField("rotation", transformRotation); subJSON.AddField("scale", scale); subJSON.AddField("size", sizeArray); subJSON.AddField("anchor", anchorArray); json.AddField("data", subJSON); return(json); }
public override void UpdateUI() { SetLabelText((Enum)UI.STR_TITLE, StringTable.Get(STRING_CATEGORY.COMMON, 103u)); SetLabelText((Enum)UI.STR_TITLE_REFLECT, StringTable.Get(STRING_CATEGORY.COMMON, 103u)); List <ItemInfo> itemList = MonoBehaviourSingleton <InventoryManager> .I.GetItemList((ItemInfo x) => x.tableData.type == ITEM_TYPE.TICKET, 0); ExpiredItem[] showList = GetItemList(itemList).ToArray(); GetCtrl(UI.LBL_CAUTION).GetComponent <UILabel>().supportEncoding = true; string text = StringTable.Get(STRING_CATEGORY.SHOP, 14u); SetLabelText((Enum)UI.LBL_CAUTION, text); SetActive((Enum)UI.BTN_TO_GACHA, MonoBehaviourSingleton <GameSceneManager> .I.GetCurrentSceneName() != "ShopScene"); SetActive((Enum)UI.GRD_LIST, showList.Length > 0); SetActive((Enum)UI.STR_ORDER_NON_LIST, showList.Length == 0); SetActive((Enum)UI.OBJ_ACTIVE_ROOT, showList.Length > 0); SetActive((Enum)UI.OBJ_INACTIVE_ROOT, showList.Length == 0); if (showList.Length == 0) { SetLabelText((Enum)UI.LBL_MAX, "0"); SetLabelText((Enum)UI.LBL_NOW, "0"); UIScrollView component = GetCtrl(UI.SCR_LIST).GetComponent <UIScrollView>(); if (component != null) { component.set_enabled(false); component.verticalScrollBar.alpha = 0f; } } else { pageMax = 1 + (showList.Length - 1) / 10; bool flag = pageMax > 1; SetActive((Enum)UI.OBJ_ACTIVE_ROOT, flag); SetActive((Enum)UI.OBJ_INACTIVE_ROOT, !flag); SetLabelText((Enum)UI.LBL_MAX, pageMax.ToString()); SetLabelText((Enum)UI.LBL_NOW, nowPage.ToString()); int num = 10 * (nowPage - 1); int num2 = (nowPage != pageMax) ? 10 : (showList.Length - num); ExpiredItem[] array = new ExpiredItem[num2]; Array.Copy(showList, num, array, 0, num2); showList = array; SetGrid(UI.GRD_LIST, "GachaTicketListItem", showList.Length, true, delegate(int i, Transform t, bool is_recycle) { ExpiredItem expiredItem = showList[i]; ItemTable.ItemData itemData = Singleton <ItemTable> .I.GetItemData((uint)expiredItem.itemId); UITexture component2 = FindCtrl(t, UI.TEX_ICON).GetComponent <UITexture>(); ResourceLoad.LoadItemIconTexture(component2, itemData.iconID); SetLabelText(t, UI.LBL_NAME, itemData.name); string empty = string.Empty; string empty2 = string.Empty; if (string.IsNullOrEmpty(expiredItem.expiredAt)) { empty = "-"; empty2 = "-"; } else { empty = expiredItem.expiredAt; empty2 = TimeManager.GetRemainTimeToText(expiredItem.expiredAt, 1); } SetLabelText(t, UI.LBL_LIMIT, empty); SetLabelText(t, UI.LBL_COUNTDOWN, empty2); }); } }
//初始化控件变量 protected override void InitControls() { fastComponent = GetComponent <FastComponent>(); fastComponent.BuildFastComponents(); m_trans_FishingContent = fastComponent.FastGetComponent <Transform>("FishingContent"); if (null == m_trans_FishingContent) { Engine.Utility.Log.Error("m_trans_FishingContent 为空,请检查prefab是否缺乏组件"); } m_btn_StartFishingBtn = fastComponent.FastGetComponent <UIButton>("StartFishingBtn"); if (null == m_btn_StartFishingBtn) { Engine.Utility.Log.Error("m_btn_StartFishingBtn 为空,请检查prefab是否缺乏组件"); } m_sprite_StartFishingBtnBg = fastComponent.FastGetComponent <UISprite>("StartFishingBtnBg"); if (null == m_sprite_StartFishingBtnBg) { Engine.Utility.Log.Error("m_sprite_StartFishingBtnBg 为空,请检查prefab是否缺乏组件"); } m_trans_PointerContent = fastComponent.FastGetComponent <Transform>("PointerContent"); if (null == m_trans_PointerContent) { Engine.Utility.Log.Error("m_trans_PointerContent 为空,请检查prefab是否缺乏组件"); } m_sprite_Pointer = fastComponent.FastGetComponent <UISprite>("Pointer"); if (null == m_sprite_Pointer) { Engine.Utility.Log.Error("m_sprite_Pointer 为空,请检查prefab是否缺乏组件"); } m_sprite_PointerBg1 = fastComponent.FastGetComponent <UISprite>("PointerBg1"); if (null == m_sprite_PointerBg1) { Engine.Utility.Log.Error("m_sprite_PointerBg1 为空,请检查prefab是否缺乏组件"); } m_sprite_PointerBg2 = fastComponent.FastGetComponent <UISprite>("PointerBg2"); if (null == m_sprite_PointerBg2) { Engine.Utility.Log.Error("m_sprite_PointerBg2 为空,请检查prefab是否缺乏组件"); } m_trans_FishTimeContent = fastComponent.FastGetComponent <Transform>("FishTimeContent"); if (null == m_trans_FishTimeContent) { Engine.Utility.Log.Error("m_trans_FishTimeContent 为空,请检查prefab是否缺乏组件"); } m_slider_FishTimeBg = fastComponent.FastGetComponent <UISlider>("FishTimeBg"); if (null == m_slider_FishTimeBg) { Engine.Utility.Log.Error("m_slider_FishTimeBg 为空,请检查prefab是否缺乏组件"); } m_sprite_FishTimeSlider = fastComponent.FastGetComponent <UISprite>("FishTimeSlider"); if (null == m_sprite_FishTimeSlider) { Engine.Utility.Log.Error("m_sprite_FishTimeSlider 为空,请检查prefab是否缺乏组件"); } m_btn_ExitFishingBtn = fastComponent.FastGetComponent <UIButton>("ExitFishingBtn"); if (null == m_btn_ExitFishingBtn) { Engine.Utility.Log.Error("m_btn_ExitFishingBtn 为空,请检查prefab是否缺乏组件"); } m_btn_rank_btn = fastComponent.FastGetComponent <UIButton>("rank_btn"); if (null == m_btn_rank_btn) { Engine.Utility.Log.Error("m_btn_rank_btn 为空,请检查prefab是否缺乏组件"); } m_label_score_num = fastComponent.FastGetComponent <UILabel>("score_num"); if (null == m_label_score_num) { Engine.Utility.Log.Error("m_label_score_num 为空,请检查prefab是否缺乏组件"); } m_label_rank_num = fastComponent.FastGetComponent <UILabel>("rank_num"); if (null == m_label_rank_num) { Engine.Utility.Log.Error("m_label_rank_num 为空,请检查prefab是否缺乏组件"); } m_trans_Center = fastComponent.FastGetComponent <Transform>("Center"); if (null == m_trans_Center) { Engine.Utility.Log.Error("m_trans_Center 为空,请检查prefab是否缺乏组件"); } m_label_fishname_label = fastComponent.FastGetComponent <UILabel>("fishname_label"); if (null == m_label_fishname_label) { Engine.Utility.Log.Error("m_label_fishname_label 为空,请检查prefab是否缺乏组件"); } m__icon = fastComponent.FastGetComponent <UITexture>("icon"); if (null == m__icon) { Engine.Utility.Log.Error("m__icon 为空,请检查prefab是否缺乏组件"); } m_sprite_qualitybox = fastComponent.FastGetComponent <UISprite>("qualitybox"); if (null == m_sprite_qualitybox) { Engine.Utility.Log.Error("m_sprite_qualitybox 为空,请检查prefab是否缺乏组件"); } m_label_score_label = fastComponent.FastGetComponent <UILabel>("score_label"); if (null == m_label_score_label) { Engine.Utility.Log.Error("m_label_score_label 为空,请检查prefab是否缺乏组件"); } if (null != fastComponent) { GameObject.Destroy(fastComponent); } }
//初始化控件变量 protected override void InitControls() { fastComponent = GetComponent <FastComponent>(); fastComponent.BuildFastComponents(); m_trans_PlayerContent = fastComponent.FastGetComponent <Transform>("PlayerContent"); if (null == m_trans_PlayerContent) { Engine.Utility.Log.Error("m_trans_PlayerContent 为空,请检查prefab是否缺乏组件"); } m__modelTexture = fastComponent.FastGetComponent <UITexture>("modelTexture"); if (null == m__modelTexture) { Engine.Utility.Log.Error("m__modelTexture 为空,请检查prefab是否缺乏组件"); } m_widget_Equipment = fastComponent.FastGetComponent <UIWidget>("Equipment"); if (null == m_widget_Equipment) { Engine.Utility.Log.Error("m_widget_Equipment 为空,请检查prefab是否缺乏组件"); } m_trans_EquipmentGridRoot = fastComponent.FastGetComponent <Transform>("EquipmentGridRoot"); if (null == m_trans_EquipmentGridRoot) { Engine.Utility.Log.Error("m_trans_EquipmentGridRoot 为空,请检查prefab是否缺乏组件"); } m_spriteEx_equipfashionbtn = fastComponent.FastGetComponent <UISpriteEx>("equipfashionbtn"); if (null == m_spriteEx_equipfashionbtn) { Engine.Utility.Log.Error("m_spriteEx_equipfashionbtn 为空,请检查prefab是否缺乏组件"); } m_widget_Fashion = fastComponent.FastGetComponent <UIWidget>("Fashion"); if (null == m_widget_Fashion) { Engine.Utility.Log.Error("m_widget_Fashion 为空,请检查prefab是否缺乏组件"); } m_label_powerLabel = fastComponent.FastGetComponent <UILabel>("powerLabel"); if (null == m_label_powerLabel) { Engine.Utility.Log.Error("m_label_powerLabel 为空,请检查prefab是否缺乏组件"); } m_trans_propRoot = fastComponent.FastGetComponent <Transform>("propRoot"); if (null == m_trans_propRoot) { Engine.Utility.Log.Error("m_trans_propRoot 为空,请检查prefab是否缺乏组件"); } m_label_ActiveGridSuitLv = fastComponent.FastGetComponent <UILabel>("ActiveGridSuitLv"); if (null == m_label_ActiveGridSuitLv) { Engine.Utility.Log.Error("m_label_ActiveGridSuitLv 为空,请检查prefab是否缺乏组件"); } m_btn_BtnGridSuitNormal = fastComponent.FastGetComponent <UIButton>("BtnGridSuitNormal"); if (null == m_btn_BtnGridSuitNormal) { Engine.Utility.Log.Error("m_btn_BtnGridSuitNormal 为空,请检查prefab是否缺乏组件"); } m_btn_BtnGridSuitActive = fastComponent.FastGetComponent <UIButton>("BtnGridSuitActive"); if (null == m_btn_BtnGridSuitActive) { Engine.Utility.Log.Error("m_btn_BtnGridSuitActive 为空,请检查prefab是否缺乏组件"); } m_label_ActiveColorSuitLv = fastComponent.FastGetComponent <UILabel>("ActiveColorSuitLv"); if (null == m_label_ActiveColorSuitLv) { Engine.Utility.Log.Error("m_label_ActiveColorSuitLv 为空,请检查prefab是否缺乏组件"); } m_btn_BtnColorSuitNormal = fastComponent.FastGetComponent <UIButton>("BtnColorSuitNormal"); if (null == m_btn_BtnColorSuitNormal) { Engine.Utility.Log.Error("m_btn_BtnColorSuitNormal 为空,请检查prefab是否缺乏组件"); } m_btn_BtnColorSuitActive = fastComponent.FastGetComponent <UIButton>("BtnColorSuitActive"); if (null == m_btn_BtnColorSuitActive) { Engine.Utility.Log.Error("m_btn_BtnColorSuitActive 为空,请检查prefab是否缺乏组件"); } m_label_ActiveStoneSuitLv = fastComponent.FastGetComponent <UILabel>("ActiveStoneSuitLv"); if (null == m_label_ActiveStoneSuitLv) { Engine.Utility.Log.Error("m_label_ActiveStoneSuitLv 为空,请检查prefab是否缺乏组件"); } m_btn_BtnStoneSuitNormal = fastComponent.FastGetComponent <UIButton>("BtnStoneSuitNormal"); if (null == m_btn_BtnStoneSuitNormal) { Engine.Utility.Log.Error("m_btn_BtnStoneSuitNormal 为空,请检查prefab是否缺乏组件"); } m_btn_BtnStoneSuitActive = fastComponent.FastGetComponent <UIButton>("BtnStoneSuitActive"); if (null == m_btn_BtnStoneSuitActive) { Engine.Utility.Log.Error("m_btn_BtnStoneSuitActive 为空,请检查prefab是否缺乏组件"); } m_trans_RideContent = fastComponent.FastGetComponent <Transform>("RideContent"); if (null == m_trans_RideContent) { Engine.Utility.Log.Error("m_trans_RideContent 为空,请检查prefab是否缺乏组件"); } m_ctor_Ridescrollview = fastComponent.FastGetComponent <UIGridCreatorBase>("Ridescrollview"); if (null == m_ctor_Ridescrollview) { Engine.Utility.Log.Error("m_ctor_Ridescrollview 为空,请检查prefab是否缺乏组件"); } m_sprite_RidePropContent = fastComponent.FastGetComponent <UISprite>("RidePropContent"); if (null == m_sprite_RidePropContent) { Engine.Utility.Log.Error("m_sprite_RidePropContent 为空,请检查prefab是否缺乏组件"); } m__model_bg = fastComponent.FastGetComponent <UITexture>("model_bg"); if (null == m__model_bg) { Engine.Utility.Log.Error("m__model_bg 为空,请检查prefab是否缺乏组件"); } m_sprite_line = fastComponent.FastGetComponent <UISprite>("line"); if (null == m_sprite_line) { Engine.Utility.Log.Error("m_sprite_line 为空,请检查prefab是否缺乏组件"); } m__rideModel = fastComponent.FastGetComponent <UITexture>("rideModel"); if (null == m__rideModel) { Engine.Utility.Log.Error("m__rideModel 为空,请检查prefab是否缺乏组件"); } m_label_speed = fastComponent.FastGetComponent <UILabel>("speed"); if (null == m_label_speed) { Engine.Utility.Log.Error("m_label_speed 为空,请检查prefab是否缺乏组件"); } m_label_level = fastComponent.FastGetComponent <UILabel>("level"); if (null == m_label_level) { Engine.Utility.Log.Error("m_label_level 为空,请检查prefab是否缺乏组件"); } m_label_Ride_Name = fastComponent.FastGetComponent <UILabel>("Ride_Name"); if (null == m_label_Ride_Name) { Engine.Utility.Log.Error("m_label_Ride_Name 为空,请检查prefab是否缺乏组件"); } m_ctor_RideSkill = fastComponent.FastGetComponent <UIGridCreatorBase>("RideSkill"); if (null == m_ctor_RideSkill) { Engine.Utility.Log.Error("m_ctor_RideSkill 为空,请检查prefab是否缺乏组件"); } m_trans_PetContent = fastComponent.FastGetComponent <Transform>("PetContent"); if (null == m_trans_PetContent) { Engine.Utility.Log.Error("m_trans_PetContent 为空,请检查prefab是否缺乏组件"); } m_ctor_petscrollview = fastComponent.FastGetComponent <UIGridCreatorBase>("petscrollview"); if (null == m_ctor_petscrollview) { Engine.Utility.Log.Error("m_ctor_petscrollview 为空,请检查prefab是否缺乏组件"); } m_trans_PetPropRoot = fastComponent.FastGetComponent <Transform>("PetPropRoot"); if (null == m_trans_PetPropRoot) { Engine.Utility.Log.Error("m_trans_PetPropRoot 为空,请检查prefab是否缺乏组件"); } m_label_typeName = fastComponent.FastGetComponent <UILabel>("typeName"); if (null == m_label_typeName) { Engine.Utility.Log.Error("m_label_typeName 为空,请检查prefab是否缺乏组件"); } m__PetModel = fastComponent.FastGetComponent <UITexture>("PetModel"); if (null == m__PetModel) { Engine.Utility.Log.Error("m__PetModel 为空,请检查prefab是否缺乏组件"); } m_label_fightingLabel = fastComponent.FastGetComponent <UILabel>("fightingLabel"); if (null == m_label_fightingLabel) { Engine.Utility.Log.Error("m_label_fightingLabel 为空,请检查prefab是否缺乏组件"); } m_label_petshowname = fastComponent.FastGetComponent <UILabel>("petshowname"); if (null == m_label_petshowname) { Engine.Utility.Log.Error("m_label_petshowname 为空,请检查prefab是否缺乏组件"); } m_ctor_SkillRoot = fastComponent.FastGetComponent <UIGridCreatorBase>("SkillRoot"); if (null == m_ctor_SkillRoot) { Engine.Utility.Log.Error("m_ctor_SkillRoot 为空,请检查prefab是否缺乏组件"); } m_trans_UIPetRideGrid = fastComponent.FastGetComponent <Transform>("UIPetRideGrid"); if (null == m_trans_UIPetRideGrid) { Engine.Utility.Log.Error("m_trans_UIPetRideGrid 为空,请检查prefab是否缺乏组件"); } m_trans_UISkillGrid = fastComponent.FastGetComponent <Transform>("UISkillGrid"); if (null == m_trans_UISkillGrid) { Engine.Utility.Log.Error("m_trans_UISkillGrid 为空,请检查prefab是否缺乏组件"); } m_trans_UIEquipGrid = fastComponent.FastGetComponent <Transform>("UIEquipGrid"); if (null == m_trans_UIEquipGrid) { Engine.Utility.Log.Error("m_trans_UIEquipGrid 为空,请检查prefab是否缺乏组件"); } if (null != fastComponent) { GameObject.Destroy(fastComponent); } }
void Awake() { _greyLabelList.Clear(); _orangeLabelList.Clear(); _greenLabelList.Clear(); _panelContainer = transform.Find("HeroAdvanced_Container"); _closeBtn = _panelContainer.Find("CloseBtn").GetComponent <UIButton>(); UIHelper.AddBtnClick(_closeBtn, OnClose); _panelName = _panelContainer.Find("panelName_Label").GetComponent <UILabel>(); _greyLabelList.Add(_panelName); _Container = _panelContainer.Find("heroInfo_Item"); _iconBg = _Container.Find("iconBg").GetComponent <UISprite>(); _formation_sprite = _Container.Find("formation_sprite").GetComponent <UISprite>(); _rank_sprite = _Container.Find("rank_sprite").GetComponent <UISprite>(); _type_Sprite = _Container.Find("type_Sprite").GetComponent <UISprite>(); _icon_Texture = _Container.Find("iicon_Texture").GetComponent <UITexture>(); _heroLevel_Label = _Container.Find("heroLevel_Label").GetComponent <UILabel>(); _greyLabelList.Add(_heroLevel_Label); _heroName_Label = _Container.Find("heroName_Label").GetComponent <UILabel>(); _heroInfo_Container = _panelContainer.Find("heroInfo_Container"); _advanced_Btn = _panelContainer.Find("manager_Btn").GetComponent <UIButton>(); UIHelper.AddBtnClick(_advanced_Btn, OnAdvanced); _advanced_Label = _panelContainer.Find("manager_Btn/Label").GetComponent <UILabel>(); _advanced_Label.color = UICommon.FONT_COLOR_GOLDEN; _advancedTitle_Label = _panelContainer.Find("advanced_Label").GetComponent <UILabel>(); _greyLabelList.Add(_advancedTitle_Label); _Level_Label = _panelContainer.Find("Level_Label").GetComponent <UILabel>(); _greyLabelList.Add(_Level_Label); _LevelValue_Label = _panelContainer.Find("Level_Label/Label").GetComponent <UILabel>(); // _LevelValue_Label.color = UICommon.FONT_COLOR_GREEN; _props_bg = _panelContainer.Find("propIconBg").GetComponent <UISprite>(); _propsIcon = _panelContainer.Find("propIconBg/propIcon").GetComponent <UISprite>(); _number_Label = _panelContainer.Find("number_Label").GetComponent <UILabel>(); // _number_Label.color = UICommon.FONT_COLOR_GREEN; _attribute_Container = _panelContainer.Find("heroInfo_Container/attribute_Container"); _attriLabel = _attribute_Container.Find("Label").GetComponent <UILabel>(); _greyLabelList.Add(_attriLabel); _attribute_Label_1 = _attribute_Container.Find("attribute_Label_1").GetComponent <UILabel>(); _greyLabelList.Add(_attribute_Label_1); _current_Label_1 = _attribute_Container.Find("attribute_Label_1/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_current_Label_1); _willbe_Label_1 = _attribute_Container.Find("attribute_Label_1/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_willbe_Label_1); _attribute_Label_2 = _attribute_Container.Find("attribute_Label_2").GetComponent <UILabel>(); _greyLabelList.Add(_attribute_Label_2); _current_Label_2 = _attribute_Container.Find("attribute_Label_2/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_current_Label_2); _willbe_Label_2 = _attribute_Container.Find("attribute_Label_2/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_willbe_Label_2); _attribute_Label_3 = _attribute_Container.Find("attribute_Label_3").GetComponent <UILabel>(); _greyLabelList.Add(_attribute_Label_3); _current_Label_3 = _attribute_Container.Find("attribute_Label_3/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_current_Label_3); _willbe_Label_3 = _attribute_Container.Find("attribute_Label_3/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_willbe_Label_3); _attribute_Label_4 = _attribute_Container.Find("attribute_Label_4").GetComponent <UILabel>(); _greyLabelList.Add(_attribute_Label_4); _current_Label_4 = _attribute_Container.Find("attribute_Label_4/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_current_Label_4); _willbe_Label_4 = _attribute_Container.Find("attribute_Label_4/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_willbe_Label_4); attributeUP_Label_1 = _attribute_Container.Find("attributeUP_Label_1").GetComponent <UILabel>(); _greyLabelList.Add(attributeUP_Label_1); _UPcurrent_Label_1 = _attribute_Container.Find("attributeUP_Label_1/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_UPcurrent_Label_1); _UPwillbe_Label_1 = _attribute_Container.Find("attributeUP_Label_1/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_UPwillbe_Label_1); attributeUP_Label_2 = _attribute_Container.Find("attributeUP_Label_2").GetComponent <UILabel>(); _greyLabelList.Add(attributeUP_Label_2); _UPcurrent_Label_2 = _attribute_Container.Find("attributeUP_Label_2/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_UPcurrent_Label_2); _UPwillbe_Label_2 = _attribute_Container.Find("attributeUP_Label_2/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_UPwillbe_Label_2); attributeUP_Label_3 = _attribute_Container.Find("attributeUP_Label_3").GetComponent <UILabel>(); _greyLabelList.Add(attributeUP_Label_3); _UPcurrent_Label_3 = _attribute_Container.Find("attributeUP_Label_3/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_UPcurrent_Label_3); _UPwillbe_Label_3 = _attribute_Container.Find("attributeUP_Label_3/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_UPwillbe_Label_3); attributeUP_Label_4 = _attribute_Container.Find("attributeUP_Label_4").GetComponent <UILabel>(); _greyLabelList.Add(attributeUP_Label_4); attributeUP_Label_4.gameObject.SetActive(false); _UPcurrent_Label_4 = _attribute_Container.Find("attributeUP_Label_4/current_Label").GetComponent <UILabel>(); _orangeLabelList.Add(_UPcurrent_Label_4); _UPwillbe_Label_4 = _attribute_Container.Find("attributeUP_Label_4/willbe_Label").GetComponent <UILabel>(); _greenLabelList.Add(_UPwillbe_Label_4); foreach (UILabel label in _greyLabelList) { label.color = UICommon.FONT_COLOR_GREY; } foreach (UILabel label in _orangeLabelList) { label.color = UICommon.FONT_COLOR_ORANGE; } foreach (UILabel label in _greenLabelList) { label.color = UICommon.FONT_COLOR_GREEN; } }
public void Awake() { texture = ((Component)base.transform).GetComponent <UITexture>(); originDepth = texture.depth; }
protected override void OnAwake() { base.OnAwake(); Transform tempTrans = null; m_toggle = CacheTransform.Find("Content/OpenContent/Toggle").GetComponent <UIToggle>(); selectMask = CacheTransform.Find("Content/OpenContent/SelectMask"); if (null != m_toggle) { m_toggle.onChange.Add(new EventDelegate(() => { if (IsSelect && !callEvent) { callEvent = true; } InvokeCallBack(); if (null != selectMask && selectMask.gameObject.activeSelf != IsSelect) { selectMask.gameObject.SetActive(IsSelect); } })); } m_tsOpen = CacheTransform.Find("Content/OpenContent"); m_tsClose = CacheTransform.Find("Content/CloseContent"); if (null != m_tsClose) { m_openAnim = m_tsClose.GetComponent <TweenRotation>(); if (null != m_openAnim) { m_openAnim.AddOnFinished(() => { OnAnimFinish(); }); } } m_tsFreeGet = CacheTransform.Find("Content/CloseContent/FreeGet"); m_tsCostRoot = CacheTransform.Find("Content/CloseContent/CostRoot"); m_tsCostMoney = CacheTransform.Find("Content/CloseContent/CostRoot/Money"); tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Money/Icon"); if (null != tempTrans) { m_moneyIcon = tempTrans.GetComponent <UISprite>(); } m_tsCostProp = CacheTransform.Find("Content/CloseContent/CostRoot/Prop"); tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Prop/Icon"); if (null != tempTrans) { m_propIcon = tempTrans.GetComponent <UITexture>(); } tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Prop/Broder"); if (null != tempTrans) { m_propBorder = tempTrans.GetComponent <UISprite>(); } tempTrans = CacheTransform.Find("Content/CloseContent/CostRoot/Num"); if (null != tempTrans) { m_costNum = tempTrans.GetComponent <UILabel>(); } tempTrans = CacheTransform.Find("Content/OpenContent/AttrRoot"); if (null != tempTrans) { int size = 5; m_TransDatas = new AttrTransData[size]; Transform tempTs = null; StringBuilder builder = new StringBuilder(); AttrTransData tempData = null; for (int i = 0; i < size; i++) { tempData = new AttrTransData(); builder.Remove(0, builder.Length); builder.Append(i + 1); tempData.Root = tempTrans.Find(builder.ToString()); builder.Remove(0, builder.Length); builder.Append(i + 1); builder.Append("/Content/Grade/Grade"); tempTs = tempTrans.Find(builder.ToString()); if (null != tempTs) { tempData.Grade = tempTs.GetComponent <UILabel>(); } builder.Remove(0, builder.Length); builder.Append(i + 1); builder.Append("/Content/Des"); tempTs = tempTrans.Find(builder.ToString()); if (null != tempTs) { tempData.Des = tempTs.GetComponent <UILabel>(); } m_TransDatas[i] = tempData; } } InitItemInfoGrid(CacheTransform.Find("Content/OpenContent/InfoGridRoot/InfoGrid"), false); }
// Token: 0x060018D8 RID: 6360 RVA: 0x000E5B8C File Offset: 0x000E3D8C private void UpdatePhotoSelection() { if (Input.GetButtonDown("A")) { if (!this.NamingBully) { UITexture uitexture = this.Photographs[this.CurrentIndex]; if (uitexture.mainTexture != this.NoPhoto) { this.ViewPhoto.mainTexture = uitexture.mainTexture; this.ViewPhoto.transform.position = uitexture.transform.position; this.ViewPhoto.transform.localScale = uitexture.transform.localScale; this.Destination.position = uitexture.transform.position; this.Viewing = true; if (!this.Corkboard) { for (int i = 1; i < 26; i++) { this.Hearts[i].gameObject.SetActive(false); } } this.CanAdjust = false; } this.UpdateButtonPrompts(); } else if (this.Photographs[this.CurrentIndex].mainTexture != this.NoPhoto && PlayerGlobals.GetBullyPhoto(this.CurrentIndex) > 0) { this.Yandere.Police.EndOfDay.FragileTarget = PlayerGlobals.GetBullyPhoto(this.CurrentIndex); this.Yandere.StudentManager.FragileOfferHelp.Continue(); this.PauseScreen.MainMenu.SetActive(true); this.Yandere.RPGCamera.enabled = true; base.gameObject.SetActive(false); this.PauseScreen.Show = false; this.PromptBar.Show = false; this.NamingBully = false; Time.timeScale = 1f; } } if (!this.NamingBully && Input.GetButtonDown("B")) { this.PromptBar.ClearButtons(); this.PromptBar.Label[0].text = "Accept"; this.PromptBar.Label[1].text = "Exit"; this.PromptBar.Label[4].text = "Choose"; this.PromptBar.Label[5].text = "Choose"; this.PromptBar.UpdateButtons(); this.PauseScreen.MainMenu.SetActive(true); this.PauseScreen.Sideways = false; this.PauseScreen.PressedB = true; base.gameObject.SetActive(false); this.UpdateButtonPrompts(); } if (Input.GetButtonDown("X")) { this.ViewPhoto.mainTexture = null; int currentIndex = this.CurrentIndex; if (this.Photographs[currentIndex].mainTexture != this.NoPhoto) { this.Photographs[currentIndex].mainTexture = this.NoPhoto; PlayerGlobals.SetPhoto(currentIndex, false); PlayerGlobals.SetSenpaiPhoto(currentIndex, false); TaskGlobals.SetGuitarPhoto(currentIndex, false); TaskGlobals.SetKittenPhoto(currentIndex, false); this.Hearts[currentIndex].gameObject.SetActive(false); this.TaskManager.UpdateTaskStatus(); } this.UpdateButtonPrompts(); } if (this.Corkboard) { if (Input.GetButtonDown("Y")) { this.CanAdjust = false; this.Cursor.gameObject.SetActive(true); this.Adjusting = true; this.UpdateButtonPrompts(); } } else if (Input.GetButtonDown("Y") && PlayerGlobals.GetSenpaiPhoto(this.CurrentIndex)) { int currentIndex2 = this.CurrentIndex; PlayerGlobals.SetSenpaiPhoto(currentIndex2, false); this.Hearts[currentIndex2].gameObject.SetActive(false); this.CanAdjust = false; this.Yandere.Sanity += 20f; this.UpdateButtonPrompts(); AudioSource.PlayClipAtPoint(this.Sighs[UnityEngine.Random.Range(0, this.Sighs.Length)], this.Yandere.Head.position); } if (this.InputManager.TappedRight) { this.Column = ((this.Column < 5) ? (this.Column + 1) : 1); } if (this.InputManager.TappedLeft) { this.Column = ((this.Column > 1) ? (this.Column - 1) : 5); } if (this.InputManager.TappedUp) { this.Row = ((this.Row > 1) ? (this.Row - 1) : 5); } if (this.InputManager.TappedDown) { this.Row = ((this.Row < 5) ? (this.Row + 1) : 1); } bool flag = this.InputManager.TappedRight || this.InputManager.TappedLeft; bool flag2 = this.InputManager.TappedUp || this.InputManager.TappedDown; if (flag || flag2) { this.Highlight.transform.localPosition = new Vector3(this.HighlightX, this.HighlightY, this.Highlight.transform.localPosition.z); this.UpdateButtonPrompts(); } this.ViewPhoto.transform.localScale = Vector3.Lerp(this.ViewPhoto.transform.localScale, new Vector3(1f, 1f, 1f), this.LerpSpeed); this.ViewPhoto.transform.position = Vector3.Lerp(this.ViewPhoto.transform.position, this.Destination.position, this.LerpSpeed); if (this.Corkboard) { this.Gallery.transform.localPosition = new Vector3(this.Gallery.transform.localPosition.x, Mathf.Lerp(this.Gallery.transform.localPosition.y, 0f, Time.deltaTime * 10f), this.Gallery.transform.localPosition.z); } }
protected override void OnEnable() { base.OnEnable(); mTex = target as UITexture; }
public void UpdateLabel() { if (this.label != null) { if (this.mDoInit) { this.Init(); } bool isSelected = this.isSelected; string value = this.value; bool flag = string.IsNullOrEmpty(value) && string.IsNullOrEmpty(Input.compositionString); this.label.color = ((!flag || isSelected) ? this.activeTextColor : this.mDefaultColor); string text; if (flag) { text = ((!isSelected) ? this.mDefaultText : string.Empty); this.RestoreLabelPivot(); } else { if (this.inputType == UIInput.InputType.Password) { text = string.Empty; string str = "*"; if (this.label.bitmapFont != null && this.label.bitmapFont.bmFont != null && this.label.bitmapFont.bmFont.GetGlyph(42) == null) { str = "x"; } int i = 0; int length = value.Length; while (i < length) { text += str; i++; } } else { text = value; } int num = (!isSelected) ? 0 : Mathf.Min(text.Length, this.cursorPosition); string str2 = text.Substring(0, num); if (isSelected) { str2 += Input.compositionString; } text = str2 + text.Substring(num, text.Length - num); if (isSelected && this.label.overflowMethod == UILabel.Overflow.ClampContent && this.label.maxLineCount == 1) { int num2 = this.label.CalculateOffsetToFit(text); if (num2 == 0) { UIInput.mDrawStart = 0; this.RestoreLabelPivot(); } else if (num < UIInput.mDrawStart) { UIInput.mDrawStart = num; this.SetPivotToLeft(); } else if (num2 < UIInput.mDrawStart) { UIInput.mDrawStart = num2; this.SetPivotToLeft(); } else { num2 = this.label.CalculateOffsetToFit(text.Substring(0, num)); if (num2 > UIInput.mDrawStart) { UIInput.mDrawStart = num2; this.SetPivotToRight(); } } if (UIInput.mDrawStart != 0) { text = text.Substring(UIInput.mDrawStart, text.Length - UIInput.mDrawStart); } } else { UIInput.mDrawStart = 0; this.RestoreLabelPivot(); } } this.label.text = text; if (isSelected && (UIInput.mKeyboard == null || this.inputShouldBeHidden)) { int num3 = this.mSelectionStart - UIInput.mDrawStart; int num4 = this.mSelectionEnd - UIInput.mDrawStart; if (this.mBlankTex == null) { this.mBlankTex = new Texture2D(2, 2, TextureFormat.ARGB32, false); for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { this.mBlankTex.SetPixel(k, j, Color.white); } } this.mBlankTex.Apply(); } if (num3 != num4) { if (this.mHighlight == null) { this.mHighlight = NGUITools.AddWidget <UITexture>(this.label.cachedGameObject); this.mHighlight.name = "Input Highlight"; this.mHighlight.mainTexture = this.mBlankTex; this.mHighlight.fillGeometry = false; this.mHighlight.pivot = this.label.pivot; this.mHighlight.SetAnchor(this.label.cachedTransform); } else { this.mHighlight.pivot = this.label.pivot; this.mHighlight.mainTexture = this.mBlankTex; this.mHighlight.MarkAsChanged(); this.mHighlight.enabled = true; } } if (this.mCaret == null) { this.mCaret = NGUITools.AddWidget <UITexture>(this.label.cachedGameObject); this.mCaret.name = "Input Caret"; this.mCaret.mainTexture = this.mBlankTex; this.mCaret.fillGeometry = false; this.mCaret.pivot = this.label.pivot; this.mCaret.SetAnchor(this.label.cachedTransform); } else { this.mCaret.pivot = this.label.pivot; this.mCaret.mainTexture = this.mBlankTex; this.mCaret.MarkAsChanged(); this.mCaret.enabled = true; } if (num3 != num4) { this.label.PrintOverlay(num3, num4, this.mCaret.geometry, this.mHighlight.geometry, this.caretColor, this.selectionColor); this.mHighlight.enabled = this.mHighlight.geometry.hasVertices; } else { this.label.PrintOverlay(num3, num4, this.mCaret.geometry, null, this.caretColor, this.selectionColor); if (this.mHighlight != null) { this.mHighlight.enabled = false; } } this.mNextBlink = RealTime.time + 0.5f; this.mLastAlpha = this.label.finalAlpha; } else { this.Cleanup(); } } }
public void _draw_labels() { MapAreaModel areaModel = StrategyTopTaskManager.Instance.TileManager.FocusTile.GetAreaModel(); RecordManager recordManager = new RecordManager(); GameObject.Find("VERSION").GetComponent <UILabel>().text = "Version 1.02"; string text = Util.RankNameJ(recordManager.Rank); if (_isRecordScene) { label = GameObject.Find("adm_name").GetComponent <UILabel>(); label.text = recordManager.Name; label = GameObject.Find("adm_level").GetComponent <UILabel>(); label.textInt = recordManager.Level; label = GameObject.Find("adm_status").GetComponent <UILabel>(); label.text = text; label = GameObject.Find("adm_exp").GetComponent <UILabel>(); label.text = recordManager.Experience + "/" + recordManager.NextExperience; } string text2 = recordManager.DeckCount + "\n" + recordManager.ShipCount + " / " + recordManager.ShipCountMax + "\n" + recordManager.SlotitemCount + " / " + recordManager.SlotitemCountMax + "\n" + recordManager.MaterialMax + "\n" + recordManager.NDockCount + "\n"; string text3; if (areaModel.NDockMax != 0) { text3 = text2; text2 = text3 + areaModel.NDockCount + " / " + areaModel.NDockMax + "\n"; } else { text2 += "- / -\n"; } text3 = text2; text2 = text3 + recordManager.KDockCount + " / " + 4; GameObject.Find("Label_3-2").GetComponent <UILabel>().text = text2; for (int i = 0; i < areaModel.GetEscortDeck().Count; i++) { csb[i] = GameObject.Find("board2nd/board1/page2/banners/banner" + (i + 1).ToString() + "/CommonShipBanner2").GetComponent <CommonShipBanner>(); csb[i].SetShipData(areaModel.GetEscortDeck().GetShips()[i]); csb[i].transform.localScale = Vector3.one * (45f / 64f); } for (int j = areaModel.GetEscortDeck().Count; j < 6; j++) { csb[j] = GameObject.Find("board2nd/board1/page2/banners/banner" + (j + 1).ToString() + "/CommonShipBanner2").GetComponent <CommonShipBanner>(); csb[j].transform.localScale = Vector3.zero; UITexture component = GameObject.Find("board2nd/board1/page2/banners/banner" + (j + 1).ToString() + "/BannerBG").GetComponent <UITexture>(); component.color = Color.gray / 2f; } UILabel component2 = GameObject.Find("board2nd/board1/page2/Labels/Label_2-2").GetComponent <UILabel>(); int countNoMove = areaModel.GetTankerCount().GetCountNoMove(); int maxCount = areaModel.GetTankerCount().GetMaxCount(); if (areaModel.Id < 15) { component2.text = countNoMove.ToString() + "/" + maxCount.ToString(); } else { component2.text = "---"; } if (areaModel.Id < 15) { component2 = GameObject.Find("board2nd/board1/page2/material/GetMaterial1/num").GetComponent <UILabel>(); component2.text = "× " + string.Format("{0, 3}", areaModel.GetResources(countNoMove)[enumMaterialCategory.Fuel]); component2 = GameObject.Find("board2nd/board1/page2/material/GetMaterial3/num").GetComponent <UILabel>(); component2.text = "× " + string.Format("{0, 3}", areaModel.GetResources(countNoMove)[enumMaterialCategory.Steel]); component2 = GameObject.Find("board2nd/board1/page2/material/GetMaterial2/num").GetComponent <UILabel>(); component2.text = "× " + string.Format("{0, 3}", areaModel.GetResources(countNoMove)[enumMaterialCategory.Bull]); component2 = GameObject.Find("board2nd/board1/page2/material/GetMaterial4/num").GetComponent <UILabel>(); component2.text = "× " + string.Format("{0, 3}", areaModel.GetResources(countNoMove)[enumMaterialCategory.Bauxite]); } else { GameObject.Find("board2nd/board1/page2/material/GetMaterial1/num").GetComponent <UILabel>().text = "× ---"; GameObject.Find("board2nd/board1/page2/material/GetMaterial3/num").GetComponent <UILabel>().text = "× ---"; GameObject.Find("board2nd/board1/page2/material/GetMaterial2/num").GetComponent <UILabel>().text = "× ---"; GameObject.Find("board2nd/board1/page2/material/GetMaterial4/num").GetComponent <UILabel>().text = "× ---"; } }
public override void Init() { base.Init(); this.skillItem = ResourceManager.LoadPath <SkillShowItem>("Prefab/UI/PlayHUD/SkillShowItem", null, 0); this.ChangePlayerTrigger = TriggerManager.CreateGameEventTrigger(GameEvent.ChangePlayer, null, new TriggerAction(this.ChangePlayer)); this.listener = TriggerManager.CreateGameEventTrigger(GameEvent.UpdateView, null, new TriggerAction(this.UpdateGoldView)); this.mFriendListen = TriggerManager.CreateGameEventTrigger(GameEvent.GameStart, null, new TriggerAction(this.OnGameStart)); this.PVEAnchor = this.transform.Find("PVEAnchor"); this.Kill = this.transform.Find("PVEAnchor/Kill"); this.Death = this.transform.Find("PVEAnchor/Death"); this.killLabel = this.transform.Find("PVEAnchor/Kill/KillNumLabel").GetComponent <UILabel>(); this.DeathLabel = this.transform.Find("PVEAnchor/Death/DeathNumLabel").GetComponent <UILabel>(); this.PVE_Boss = this.PVEAnchor.Find("Boss/BossNumLabel").GetComponent <UILabel>(); this.PVE_Assists = this.PVEAnchor.Find("Assists/AssistsNumLabel").GetComponent <UILabel>(); this.PVPAnchor = this.transform.Find("PVPAnchor"); this.PVP_KillLabel = this.PVPAnchor.Find("Kill/KillNumLabel").GetComponent <UILabel>(); this.PVP_Death = this.PVPAnchor.Find("Death/DeathNumLabel").GetComponent <UILabel>(); this.PVE_Time = this.PVEAnchor.Find("Time/TimeLabel").GetComponent <UILabel>(); this.PVP_Time = this.PVPAnchor.Find("Time/TimeLabel").GetComponent <UILabel>(); this.PVP_Assists = this.PVPAnchor.Find("Assists/AssistsNumLabel").GetComponent <UILabel>(); this.PVP_Boss = this.PVPAnchor.Find("Boss/BossNumLabel").GetComponent <UILabel>(); this.BottomRightAnchor = this.transform.Find("BottomRightAnchor"); this.bottomPveAnchor = this.BottomRightAnchor.Find("Pve"); this.bottomPvpAnchor = this.BottomRightAnchor.Find("Pvp"); this.LeftTopAnchor = this.transform.Find("LeftTopAnchor"); this.SkillPveBtn = this.bottomPveAnchor.Find("SkillBtn"); this.SkillPvpBtn = this.bottomPvpAnchor.Find("SkillBtn"); this.SkillPveSprite = this.SkillPveBtn.GetComponent <UISprite>(); this.SkillPveSprite2 = this.bottomPveAnchor.Find("SkillBtn/SkillBtn2").GetComponent <UISprite>(); this.SkillPvpSprite = this.SkillPvpBtn.GetComponent <UISprite>(); this.SkillPvpSprite2 = this.bottomPvpAnchor.Find("SkillBtn/SkillBtn2").GetComponent <UISprite>(); this.StatisticPveBtn = this.bottomPveAnchor.Find("StatisticBtn"); this.StatisticPvpBtn = this.bottomPvpAnchor.Find("StatisticBtn"); this.StatisticBtn1 = this.LeftTopAnchor.Find("StatisticBtn"); this.B_Game = this.transform.Find("Center/Game"); this.Suspend = this.bottomPveAnchor.Find("Suspend"); this.Setting = this.bottomPvpAnchor.Find("Setting"); this.Suspend1 = this.LeftTopAnchor.Find("Suspend"); this.FPSLabel = this.transform.Find("Center/Game/FPS/Label").GetComponent <UILabel>(); this.DelayLabel = this.transform.Find("Center/Game/Delay/Label").GetComponent <UILabel>(); this.BottomAnchor = this.transform.Find("BottomAnchor"); this.TestBtn = this.bottomPveAnchor.Find("TestBtn"); this.DebugObj = this.bottomPvpAnchor.Find("Debug"); this.ResetBtn = this.bottomPveAnchor.Find("ResetBtn"); this.SpeedBtn = this.DebugObj.Find("SpeedBtn"); this.SpeedLabel = this.SpeedBtn.Find("speed").GetComponent <UILabel>(); this.ResetSpeedBtn = this.DebugObj.Find("ResetSpeedBtn"); this.skillBackBg = this.transform.Find("BottomAnchor/SkillBg/BackBg"); this.LevelBtn = this.DebugObj.Find("LevelBtn"); this.EnableHeroAIBnt = this.DebugObj.Find("Toggle/EnableHeroAI"); this.EnableMonsterAIBnt = this.DebugObj.Find("Toggle/EnableMonsterAI"); this.EnableTowerAIBnt = this.DebugObj.Find("Toggle/EnableTowerAI"); this.EnableAllAIBnt = this.DebugObj.Find("Toggle/EnableAllAI"); this.NoMonsterBnt = this.DebugObj.Find("Toggle/NoMontser"); this.NoSkillCdBnt = this.DebugObj.Find("Toggle/NoSkillCd"); this.NoSkillCostBnt = this.DebugObj.Find("Toggle/NoSkillCost"); this.WhoIsYourDady = this.DebugObj.Find("Toggle/WhoIsYourDady"); this.AddBlood = this.DebugObj.Find("Toggle/AddBlood"); this.Toggle = this.DebugObj.Find("Toggle"); this.heroTargetInfo = this.transform.Find("TargetBox/HeroTarget"); this.heroTexture = this.heroTargetInfo.Find("Sprite/Texture").GetComponent <UITexture>(); this.heroBloodSprite = this.heroTargetInfo.Find("HPBar/SlideBlood").GetComponent <UISprite>(); this.heroHpNumber = this.heroTargetInfo.Find("HPBar/HPNumber").GetComponent <UILabel>(); this.heroKillInfo = this.heroTargetInfo.Find("KillInfo/KillNumber").GetComponent <UILabel>(); this.otherTargetInfo = this.transform.Find("TargetBox/OtherTarget"); this.otherTexture = this.otherTargetInfo.Find("Sprite/Texture").GetComponent <UITexture>(); this.backTexture = this.otherTexture.mainTexture; this.otherBloodSprite = this.otherTargetInfo.Find("HPBar/HPBar/SlideBlood").GetComponent <UISprite>(); this.otherHpNumber = this.otherTargetInfo.Find("HPBar/HPBar/HPNumber").GetComponent <UILabel>(); this.otherName = this.otherTargetInfo.Find("Name/name").GetComponent <UILabel>(); this.skillBg = this.BottomAnchor.Find("SkillBg").GetComponent <UIPanel>(); this.B_Grid = this.BottomAnchor.Find("SkillBg/Grid").GetComponent <UIGrid>(); UIEventListener.Get(this.Suspend.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnSuspend); UIEventListener.Get(this.Setting.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnSuspend); UIEventListener.Get(this.SkillPveBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickSkillBtn); UIEventListener.Get(this.SkillPvpBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickSkillBtn); UIEventListener.Get(this.SkillPveSprite2.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickSkillBtn); UIEventListener.Get(this.SkillPvpSprite2.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickSkillBtn); UIEventListener.Get(this.StatisticPveBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickStatisticBtn); UIEventListener.Get(this.StatisticPvpBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickStatisticBtn); UIEventListener.Get(this.StatisticBtn1.gameObject).onClick = new UIEventListener.VoidDelegate(this.ClickStatisticBtn); UIEventListener.Get(this.Suspend1.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnSuspend); UIEventListener.Get(this.TestBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnTestBtn); UIEventListener.Get(this.ResetBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnResetBtn); UIEventListener.Get(this.SpeedBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnSpeedBtn); UIEventListener.Get(this.ResetSpeedBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnResetSpeedBtn); UIEventListener.Get(this.LevelBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnLevelBtn); UIEventListener.Get(this.skillBackBg.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnskillBackBg); UIEventListener.Get(this.EnableHeroAIBnt.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.EnableTowerAIBnt.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.EnableMonsterAIBnt.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.EnableAllAIBnt.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.NoMonsterBnt.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.NoSkillCdBnt.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.NoSkillCostBnt.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.WhoIsYourDady.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); UIEventListener.Get(this.AddBlood.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnGameCommand); this.ResetFpsData(); this.mFriendInfo = this.transform.Find("BattleFriendNotice"); this.mLockViewSprite = this.transform.Find("BattleFriendNotice/DragPlayerView/LockSprite").GetComponent <UISprite>(); this.mUnlockViewSprite = this.transform.Find("BattleFriendNotice/DragPlayerView/UnlockSprite").GetComponent <UISprite>(); this.mFriendList = this.transform.Find("BattleFriendNotice/FriendList"); UIEventListener.Get(this.mLockViewSprite.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnPressLockView); UIEventListener.Get(this.mUnlockViewSprite.gameObject).onClick = new UIEventListener.VoidDelegate(this.OnPressUnlockView); Units player = PlayerControlMgr.Instance.GetPlayer(); this.ShowDebugPvp(); this.bInitFriendFinished = false; }
private void StartUp() { _StartUp = true; if (_DEBUG_MODE_NOW_) { _dbg_class = 1; _DBG_Button_L = ((Component)base.transform.FindChild("Debug_ship/DBG_Button_L")).GetComponent <UIButton>(); _DBG_Button_R = ((Component)base.transform.FindChild("Debug_ship/DBG_Button_R")).GetComponent <UIButton>(); UIButtonMessage component = _DBG_Button_L.GetComponent <UIButtonMessage>(); component.target = base.gameObject; component.functionName = "Pressed_DBG_Button_L"; component.trigger = UIButtonMessage.Trigger.OnClick; UIButtonMessage component2 = _DBG_Button_R.GetComponent <UIButtonMessage>(); component2.target = base.gameObject; component2.functionName = "Pressed_DBG_Button_R"; component2.trigger = UIButtonMessage.Trigger.OnClick; } UIDisplaySwipeEventRegion component3 = GameObject.Find("TouchEventArea").GetComponent <UIDisplaySwipeEventRegion>(); Camera component4; if (Application.loadedLevelName == "Record") { _isRecordScene = true; component4 = GameObject.Find("Camera").GetComponent <Camera>(); SingletonMonoBehaviour <PortObjectManager> .Instance.PortTransition.EndTransition(delegate { ShipUtils.PlayShipVoice(SingletonMonoBehaviour <AppInformation> .Instance.CurrentDeck.GetFlagShip(), 8); }); } else { _isRecordScene = false; component4 = GameObject.Find("OverViewCamera").GetComponent <Camera>(); } component3.SetOnSwipeActionJudgeCallBack(SwipeJudgeDelegate); component3.SetEventCatchCamera(component4); _ANIM_filebase = "boards_mvud"; _AM = GameObject.Find("RecordScene").GetComponent <Animation>(); if (_isRecordScene) { _AM_l = GameObject.Find("medalist").GetComponent <Animation>(); } _AM_b = GameObject.Find("btn").GetComponent <Animation>(); _SM = SingletonMonoBehaviour <SoundManager> .Instance; _Button_L = ((Component)base.transform.FindChild("btn/Button_L")).GetComponent <UIButton>(); _Button_R = ((Component)base.transform.FindChild("btn/Button_R")).GetComponent <UIButton>(); _Button_L_B = ((Component)base.transform.FindChild("btn/Button_L/Background")).GetComponent <UITexture>(); _Button_R_B = ((Component)base.transform.FindChild("btn/Button_R/Background")).GetComponent <UITexture>(); _Button_L_B.transform.localScale = Vector3.zero; _Button_R_B.transform.localScale = Vector3.one; UIButtonMessage component5 = _Button_L.GetComponent <UIButtonMessage>(); component5.target = base.gameObject; component5.functionName = "Pressed_Button_L"; component5.trigger = UIButtonMessage.Trigger.OnClick; UIButtonMessage component6 = _Button_R.GetComponent <UIButtonMessage>(); component6.target = base.gameObject; component6.functionName = "Pressed_Button_R"; component6.trigger = UIButtonMessage.Trigger.OnClick; _board1 = GameObject.Find("board1"); ItemSelectController = new KeyControl(0, 2); ItemSelectController.setChangeValue(-1f, 0f, 1f, 0f); _draw_labels(); _now_page = 1; ShipModel shipModel = (SingletonMonoBehaviour <AppInformation> .Instance.FlagShipModel == null) ? new ShipModel(1) : SingletonMonoBehaviour <AppInformation> .Instance.FlagShipModel; _flag_ship = shipModel.GetGraphicsMstId(); DamageState damageStatus = shipModel.DamageStatus; if (damageStatus == DamageState.Normal || damageStatus == DamageState.Shouha) { _damaged = false; } else { _damaged = true; } }
public void ucitaj_slikice() { string postojece = ""; string file = ""; int[] slike = rnr.numNoRepeat(0, reci.sve_reci.Count, 12); slike [0] = 0; slike [1] = 0; for (int i = 1; i < 7; i++) { GameObject go = GameObject.Find("slika" + i.ToString()); go.collider.enabled = true; go.GetComponent <UITexture>().color = Color.white; go.GetComponentInChildren <UISprite> ().spriteName = ""; UILabel lbl = go.transform.GetComponentInChildren <UILabel>() as UILabel; lbl.text = ""; lbl.enabled = false; go.transform.position = GameObject.Find("poc_pos" + i.ToString()).transform.position; slika = go.GetComponent <UITexture>(); file = reci.sve_reci [slike[i - 1]]; //if (file.StartsWith (slova.trenutno_slovo.ToUpper())) file = reci.sve_reci[slike[i+5]]; if (file.StartsWith(slova.trenutno_slovo.ToUpper()) || postojece.Contains(file)) //file = reci.sve_reci.Find (x=> !x.StartsWith (slova.trenutno_slovo.ToUpper()) ); { do { file = reci.sve_reci[Random.Range(0, reci.sve_reci.Count)]; }while ( file.StartsWith(slova.trenutno_slovo.ToUpper()) || postojece.Contains(file) ); } postojece = postojece + "," + file; Debug.Log(postojece); slika.mainTexture = Resources.Load("azbuka_pics/u_krugu/" + file) as Texture2D; // slika.MakePixelPerfect (); slika.SetDimensions(512, 512); slika.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); } file = ""; string slovo = slova.trenutno_slovo; // Debug.Log (slovo); int [] position = rnr.numNoRepeat(1, 7, 3); Debug.Log(position.ToString()); // foreach (string str in reci.biljke) // { // Debug.Log ("U FOREASCHHHHH"); // if (str.StartsWith (slovo)) file = str; // } //// biljka.mainTexture=Resources.Load ("azbuka_pics/biljke/" + file) as Texture2D ; // // foreach (string str in reci.zivotinje) // { // if (str.StartsWith (slovo)) file = str; // } // // zivotinja.mainTexture=Resources.Load ("azbuka_pics/zivotinje/" + file) as Texture2D ; int j = 0; // List <string> na_slovo = new List<string> (); foreach (string str in reci.sve_reci) { if (str.StartsWith(slovo.ToUpper()) && j < 3) { string rec = str.Split('_')[0]; Debug.Log("VREDNOST J : " + j + " Pos " + position[j] + " Rec:" + rec); slika = GameObject.Find("slika" + position[j].ToString()).GetComponent <UITexture>(); slika.mainTexture = Resources.Load("azbuka_pics/u_krugu/" + str) as Texture2D; j++; UILabel lbl = slika.transform.GetComponentInChildren <UILabel>() as UILabel; lbl.text = rec; lbl.enabled = false; } } sound.playSound("na_slovo", 1f); StartCoroutine("sacekaj", 2.2f); //string dir, file; // StartCoroutine (sacekaj (1.5f)); }
public virtual bool Init(ShipModel ship, UITexture _texture) { return(true); }
public void Download(UITexture tex, string imgurl, bool isKongWei = false) { StartCoroutine(DownloadHead(tex, imgurl)); }
//初始化控件变量 protected override void InitControls() { fastComponent = GetComponent <FastComponent>(); fastComponent.BuildFastComponents(); m_trans_Content = fastComponent.FastGetComponent <Transform>("Content"); if (null == m_trans_Content) { Engine.Utility.Log.Error("m_trans_Content 为空,请检查prefab是否缺乏组件"); } m_ctor_ExchangeScrollView = fastComponent.FastGetComponent <UIGridCreatorBase>("ExchangeScrollView"); if (null == m_ctor_ExchangeScrollView) { Engine.Utility.Log.Error("m_ctor_ExchangeScrollView 为空,请检查prefab是否缺乏组件"); } m_ctor_CategoryTagContent = fastComponent.FastGetComponent <UIGridCreatorBase>("CategoryTagContent"); if (null == m_ctor_CategoryTagContent) { Engine.Utility.Log.Error("m_ctor_CategoryTagContent 为空,请检查prefab是否缺乏组件"); } m_trans_RightContent = fastComponent.FastGetComponent <Transform>("RightContent"); if (null == m_trans_RightContent) { Engine.Utility.Log.Error("m_trans_RightContent 为空,请检查prefab是否缺乏组件"); } m_trans_ExchangeContent = fastComponent.FastGetComponent <Transform>("ExchangeContent"); if (null == m_trans_ExchangeContent) { Engine.Utility.Log.Error("m_trans_ExchangeContent 为空,请检查prefab是否缺乏组件"); } m_trans_ItemInfo = fastComponent.FastGetComponent <Transform>("ItemInfo"); if (null == m_trans_ItemInfo) { Engine.Utility.Log.Error("m_trans_ItemInfo 为空,请检查prefab是否缺乏组件"); } m_label_ItemName = fastComponent.FastGetComponent <UILabel>("ItemName"); if (null == m_label_ItemName) { Engine.Utility.Log.Error("m_label_ItemName 为空,请检查prefab是否缺乏组件"); } m_label_ItemDes = fastComponent.FastGetComponent <UILabel>("ItemDes"); if (null == m_label_ItemDes) { Engine.Utility.Log.Error("m_label_ItemDes 为空,请检查prefab是否缺乏组件"); } m_label_ItemUseLv = fastComponent.FastGetComponent <UILabel>("ItemUseLv"); if (null == m_label_ItemUseLv) { Engine.Utility.Log.Error("m_label_ItemUseLv 为空,请检查prefab是否缺乏组件"); } m_trans_ItemBaseGridRoot = fastComponent.FastGetComponent <Transform>("ItemBaseGridRoot"); if (null == m_trans_ItemBaseGridRoot) { Engine.Utility.Log.Error("m_trans_ItemBaseGridRoot 为空,请检查prefab是否缺乏组件"); } m_trans_CostInfo = fastComponent.FastGetComponent <Transform>("CostInfo"); if (null == m_trans_CostInfo) { Engine.Utility.Log.Error("m_trans_CostInfo 为空,请检查prefab是否缺乏组件"); } m__CostIcon = fastComponent.FastGetComponent <UITexture>("CostIcon"); if (null == m__CostIcon) { Engine.Utility.Log.Error("m__CostIcon 为空,请检查prefab是否缺乏组件"); } m_label_CostNum = fastComponent.FastGetComponent <UILabel>("CostNum"); if (null == m_label_CostNum) { Engine.Utility.Log.Error("m_label_CostNum 为空,请检查prefab是否缺乏组件"); } m_trans_OwnInfo = fastComponent.FastGetComponent <Transform>("OwnInfo"); if (null == m_trans_OwnInfo) { Engine.Utility.Log.Error("m_trans_OwnInfo 为空,请检查prefab是否缺乏组件"); } m__OwnIcon = fastComponent.FastGetComponent <UITexture>("OwnIcon"); if (null == m__OwnIcon) { Engine.Utility.Log.Error("m__OwnIcon 为空,请检查prefab是否缺乏组件"); } m_label_OwnNum = fastComponent.FastGetComponent <UILabel>("OwnNum"); if (null == m_label_OwnNum) { Engine.Utility.Log.Error("m_label_OwnNum 为空,请检查prefab是否缺乏组件"); } m_btn_ItemGetBtn = fastComponent.FastGetComponent <UIButton>("ItemGetBtn"); if (null == m_btn_ItemGetBtn) { Engine.Utility.Log.Error("m_btn_ItemGetBtn 为空,请检查prefab是否缺乏组件"); } m_btn_ExchangeBtn = fastComponent.FastGetComponent <UIButton>("ExchangeBtn"); if (null == m_btn_ExchangeBtn) { Engine.Utility.Log.Error("m_btn_ExchangeBtn 为空,请检查prefab是否缺乏组件"); } m_btn_BtnAdd = fastComponent.FastGetComponent <UIButton>("BtnAdd"); if (null == m_btn_BtnAdd) { Engine.Utility.Log.Error("m_btn_BtnAdd 为空,请检查prefab是否缺乏组件"); } m_btn_BtnRemove = fastComponent.FastGetComponent <UIButton>("BtnRemove"); if (null == m_btn_BtnRemove) { Engine.Utility.Log.Error("m_btn_BtnRemove 为空,请检查prefab是否缺乏组件"); } m_label_ExchangeNum = fastComponent.FastGetComponent <UILabel>("ExchangeNum"); if (null == m_label_ExchangeNum) { Engine.Utility.Log.Error("m_label_ExchangeNum 为空,请检查prefab是否缺乏组件"); } m_btn_BtnMax = fastComponent.FastGetComponent <UIButton>("BtnMax"); if (null == m_btn_BtnMax) { Engine.Utility.Log.Error("m_btn_BtnMax 为空,请检查prefab是否缺乏组件"); } m_btn_HandInputBtn = fastComponent.FastGetComponent <UIButton>("HandInputBtn"); if (null == m_btn_HandInputBtn) { Engine.Utility.Log.Error("m_btn_HandInputBtn 为空,请检查prefab是否缺乏组件"); } m_ctor_RightTabRoot = fastComponent.FastGetComponent <UIGridCreatorBase>("RightTabRoot"); if (null == m_ctor_RightTabRoot) { Engine.Utility.Log.Error("m_ctor_RightTabRoot 为空,请检查prefab是否缺乏组件"); } m_trans_UITabGrid = fastComponent.FastGetComponent <Transform>("UITabGrid"); if (null == m_trans_UITabGrid) { Engine.Utility.Log.Error("m_trans_UITabGrid 为空,请检查prefab是否缺乏组件"); } m_trans_UIExchangeGrid = fastComponent.FastGetComponent <Transform>("UIExchangeGrid"); if (null == m_trans_UIExchangeGrid) { Engine.Utility.Log.Error("m_trans_UIExchangeGrid 为空,请检查prefab是否缺乏组件"); } m_trans_TogglePanel = fastComponent.FastGetComponent <Transform>("TogglePanel"); if (null == m_trans_TogglePanel) { Engine.Utility.Log.Error("m_trans_TogglePanel 为空,请检查prefab是否缺乏组件"); } if (null != fastComponent) { GameObject.Destroy(fastComponent); } }
public void nyukyogo(int dock, ShipModel ship, bool _isRepairKit) { Debug.Log("入渠します Dock:" + dock + " MemId:" + ship.MemId + " 高速:" + _isRepairKit + " 耐久度率:" + ship.TaikyuRate); if (_isRepairKit) { StartCoroutine(WaitAndSpeak(ship, 26, 1.5f)); } else if (ship.TaikyuRate >= 50.0) { StartCoroutine(WaitAndSpeak(ship, 11, 1.5f)); } else { StartCoroutine(WaitAndSpeak(ship, 12, 1.5f)); } _clsRepair.StartRepair(dock, ship.MemId, _isRepairKit); GameObject gameObject = GameObject.Find("board1_top/board/Grid/0" + dock.ToString()); if (_isRepairKit) { bd1.set_HS_anime(dock, stat: true); GameObject.Find("board1_top/board").GetComponent <board>().set_rnow_enable(dock, a: true); GameObject.Find("board1_top/board").GetComponent <board>().set_stk_enable(dock, a: false); dg = GameObject.Find("dialog").GetComponent <dialog>(); int num = dock; tex = GameObject.Find("board/Grid/0" + num.ToString() + "/repair_now/ship_banner").GetComponent <UITexture>(); if (ship.DamageStatus == DamageState.Taiha) { tex.mainTexture = SingletonMonoBehaviour <ResourceManager> .Instance.ShipTexture.Load(ship.MstId, 2); } else if (ship.DamageStatus == DamageState.Tyuuha) { tex.mainTexture = SingletonMonoBehaviour <ResourceManager> .Instance.ShipTexture.Load(ship.MstId, 2); } else { tex.mainTexture = SingletonMonoBehaviour <ResourceManager> .Instance.ShipTexture.Load(ship.MstId, 1); } int num2 = dock; lab = GameObject.Find("board/Grid/0" + num2.ToString() + "/repair_now/text_ship_name").GetComponent <UILabel>(); lab.text = ship.Name; int num3 = dock; lab = GameObject.Find("board/Grid/0" + num3.ToString() + "/repair_now/text_level").GetComponent <UILabel>(); lab.text = string.Empty + ship.Level; int num4 = dock; lab = GameObject.Find("board/Grid/0" + num4.ToString() + "/repair_now/text_hp").GetComponent <UILabel>(); lab.text = dg.GetBeforeHp() + "/" + ship.MaxHp; bd1.set_dock_MaxHP(dock, ship.MaxHp); int num5 = dock; sprite = GameObject.Find("board/Grid/0" + num5.ToString() + "/repair_now/HP_Gauge/panel/HP_bar_meter").GetComponent <UISprite>(); sprite.width = (int)((float)dg.GetBeforeHp() * 210f / (float)ship.MaxHp); sprite.color = Util.HpGaugeColor2(ship.MaxHp, dg.GetBeforeHp()); int num6 = dock; sprite = GameObject.Find("board/Grid/0" + num6.ToString() + "/repair_now/HP_Gauge/panel/HP_bar_meter2").GetComponent <UISprite>(); sprite.width = (int)((float)dg.GetBeforeHp() * 210f / (float)ship.MaxHp); sprite.color = Util.HpGaugeColor2(ship.MaxHp, dg.GetBeforeHp()); int num7 = dock; lab = GameObject.Find("board/Grid/0" + num7.ToString() + "/repair_now/text_least_time").GetComponent <UILabel>(); lab.text = string.Empty + ship.RepairTime; int num8 = dock; GameObject.Find("board/Grid/0" + num8.ToString() + "/repair_now/btn_high_repair").GetComponent <UIButton>().isEnabled = false; crane_anime component = GameObject.Find("board/Grid/0" + dock.ToString() + "/Anime").GetComponent <crane_anime>(); component.high_repair_anime(dock, _low_anime: false); } else { iTween.MoveTo(gameObject.gameObject, iTween.Hash("islocal", true, "x", 1000f, "time", 0.1f)); } bd2.UpdateList(); update_portframe(); SingletonMonoBehaviour <UIPortFrame> .Instance.UpdateHeaderInfo(_clsRepair); }
public override void Show() { if (base.enabled && NGUITools.GetActive(base.gameObject) && UIPopupList.mChild == null && this.atlas != null && this.isValid && this.items.Count > 0) { this.mLabelList.Clear(); base.StopCoroutine("CloseIfUnselected"); UICamera.selectedObject = (UICamera.hoveredObject ?? base.gameObject); this.mSelection = UICamera.selectedObject; this.source = UICamera.selectedObject; if (this.source == null) { Debug.LogError("Popup list needs a source object..."); return; } this.mOpenFrame = Time.frameCount; if (this.mPanel == null) { this.mPanel = UIPanel.Find(base.transform); if (this.mPanel == null) { return; } } UIPopupList.mChild = new GameObject("Drop-down List"); UIPopupList.mChild.layer = base.gameObject.layer; UIPopupList.current = this; Transform transform = UIPopupList.mChild.transform; transform.parent = this.mPanel.cachedTransform; Vector3 vector; Vector3 vector2; Vector3 vector3; if (this.openOn == UIPopupList.OpenOn.Manual && this.mSelection != base.gameObject) { vector = UICamera.lastEventPosition; vector2 = this.mPanel.cachedTransform.InverseTransformPoint(this.mPanel.anchorCamera.ScreenToWorldPoint(vector)); vector3 = vector2; transform.localPosition = vector2; vector = transform.position; } else { Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(this.mPanel.cachedTransform, base.transform, false, false); vector2 = bounds.min; vector3 = bounds.max; transform.localPosition = vector2; vector = transform.position; } base.StartCoroutine("CloseIfUnselected"); transform.localRotation = Quaternion.identity; transform.localScale = Vector3.one; this.mBackground = NGUITools.AddSprite(UIPopupList.mChild, this.atlas, this.backgroundSprite); this.mBackground.pivot = UIWidget.Pivot.TopLeft; this.mBackground.depth = NGUITools.CalculateNextDepth(this.mPanel.gameObject); this.mBackground.color = this.backgroundColor; Vector4 border = this.mBackground.border; this.mBgBorder = border.y; this.mBackground.cachedTransform.localPosition = new Vector3(0f, border.y, 0f); this.mHighlight = NGUITools.AddSprite(UIPopupList.mChild, this.atlas, this.highlightSprite); this.mHighlight.pivot = UIWidget.Pivot.TopLeft; this.mHighlight.color = this.highlightColor; UISpriteData atlasSprite = this.mHighlight.GetAtlasSprite(); if (atlasSprite == null) { return; } float num = (float)atlasSprite.borderTop; float num2 = (float)this.activeFontSize; float activeFontScale = this.activeFontScale; float num3 = num2 * activeFontScale; float num4 = 0f; float num5 = -this.padding.y; List <UILabel> list = new List <UILabel>(); List <UITexture> list2 = new List <UITexture>(); if (!this.items.Contains(this.mSelectedItem)) { this.mSelectedItem = null; } int i = 0; int count = this.items.Count; while (i < count) { string text = this.items[i]; Texture texture = this.itemsIcon[i]; UILabel uilabel = NGUITools.AddWidget <UILabel>(UIPopupList.mChild); uilabel.name = i.ToString(); uilabel.pivot = UIWidget.Pivot.TopLeft; uilabel.bitmapFont = this.bitmapFont; uilabel.trueTypeFont = this.trueTypeFont; uilabel.fontSize = this.fontSize; uilabel.fontStyle = this.fontStyle; string text2 = (!this.isLocalized) ? text : Localization.Get(text); if (this.toUpper) { text2 = text2.ToUpper(); } uilabel.text = text2; uilabel.color = this.textColor; uilabel.cachedTransform.localPosition = new Vector3(border.x + this.padding.x - uilabel.pivotOffset.x + this.iconWidth, num5, -1f); uilabel.overflowMethod = UILabel.Overflow.ResizeFreely; uilabel.alignment = this.alignment; list.Add(uilabel); if (texture) { UITexture uitexture = NGUITools.AddWidget <UITexture>(uilabel.gameObject); uitexture.name = i.ToString(); uitexture.pivot = UIWidget.Pivot.TopLeft; uitexture.width = 28; uitexture.height = 18; uitexture.mainTexture = texture; uitexture.cachedTransform.localPosition = new Vector3(-this.iconWidth, 0f, -1f); list2.Add(uitexture); } else { list2.Add(null); } num5 -= num3; num5 -= this.padding.y; num4 = Mathf.Max(num4, uilabel.printedSize.x); UIEventListener uieventListener = UIEventListener.Get(uilabel.gameObject); uieventListener.onHover = new UIEventListener.BoolDelegate(base.OnItemHover); uieventListener.onPress = new UIEventListener.BoolDelegate(base.OnItemPress); uieventListener.parameter = text; if (this.mSelectedItem == text || (i == 0 && string.IsNullOrEmpty(this.mSelectedItem))) { base.Highlight(uilabel, true); } this.mLabelList.Add(uilabel); i++; } num4 = Mathf.Max(num4 + this.iconWidth, vector3.x - vector2.x - (border.x + this.padding.x) * 2f); float num6 = num4; Vector3 vector4 = new Vector3(num6 * 0.5f, -num3 * 0.5f, 0f); Vector3 vector5 = new Vector3(num6, num3 + this.padding.y, 1f); int j = 0; int count2 = list.Count; while (j < count2) { UILabel uilabel2 = list[j]; NGUITools.AddWidgetCollider(uilabel2.gameObject); uilabel2.autoResizeBoxCollider = false; BoxCollider component = uilabel2.GetComponent <BoxCollider>(); if (component != null) { vector4.z = component.center.z; component.center = vector4; component.size = vector5; } else { BoxCollider2D component2 = uilabel2.GetComponent <BoxCollider2D>(); component2.offset = vector4; component2.size = vector5; } j++; } int width = Mathf.RoundToInt(num4); num4 += (border.x + this.padding.x) * 2f; num5 -= border.y; this.mBackground.width = Mathf.RoundToInt(num4); this.mBackground.height = Mathf.RoundToInt(-num5 + border.y); int k = 0; int count3 = list.Count; while (k < count3) { UILabel uilabel3 = list[k]; uilabel3.overflowMethod = UILabel.Overflow.ShrinkContent; uilabel3.width = width; k++; } float num7 = 2f * this.atlas.pixelSize; float f = num4 - (border.x + this.padding.x) * 2f + (float)atlasSprite.borderLeft * num7; float f2 = num3 + num * num7; this.mHighlight.width = Mathf.RoundToInt(f); this.mHighlight.height = Mathf.RoundToInt(f2); bool flag = this.position == UIPopupList.Position.Above; UICamera uicamera = UICamera.FindCameraForLayer(this.mSelection.layer); if (this.position == UIPopupList.Position.Auto && uicamera != null) { flag = (uicamera.cachedCamera.WorldToViewportPoint(vector).y < 0.5f); } if (this.isAnimated) { base.AnimateColor(this.mBackground); if (Time.timeScale == 0f || Time.timeScale >= 0.1f) { float bottom = num5 + num3; base.Animate(this.mHighlight, flag, bottom); int l = 0; int count4 = list.Count; while (l < count4) { base.Animate(list[l], flag, bottom); l++; } base.AnimateScale(this.mBackground, flag, bottom); } } if (flag) { vector2.y = vector3.y - border.y; vector3.y = vector2.y + (float)this.mBackground.height; vector3.x = vector2.x + (float)this.mBackground.width; transform.localPosition = new Vector3(vector2.x, vector3.y - border.y, vector2.z); } else { vector3.y = vector2.y + border.y; vector2.y = vector3.y - (float)this.mBackground.height; vector3.x = vector2.x + (float)this.mBackground.width; } Transform parent = this.mPanel.cachedTransform.parent; if (parent != null) { vector2 = this.mPanel.cachedTransform.TransformPoint(vector2); vector3 = this.mPanel.cachedTransform.TransformPoint(vector3); vector2 = parent.InverseTransformPoint(vector2); vector3 = parent.InverseTransformPoint(vector3); } if (uicamera != null) { transform.position = base.transform.TransformPoint(new Vector3((float)(-(float)this.mBackground.width) + this.iconWidth / 2f, (float)(((!flag) ? -1 : 1) * (this.mBackground.height + 10)), 0f)); } else { Vector3 b = (!this.mPanel.hasClipping) ? this.mPanel.CalculateConstrainOffset(vector2, vector3) : Vector3.zero; vector = transform.localPosition + b; vector.x = Mathf.Round(vector.x); vector.y = Mathf.Round(vector.y); transform.localPosition = vector; } } else { base.OnSelect(false); } }
public void UpdateLabel() { if (label != null) { if (mDoInit) { Init(); } bool isSelected = this.isSelected; string value = this.value; bool flag = string.IsNullOrEmpty(value) && string.IsNullOrEmpty(Input.compositionString); label.color = ((!flag || isSelected) ? activeTextColor : mDefaultColor); string text; if (flag) { text = ((!isSelected) ? mDefaultText : string.Empty); RestoreLabelPivot(); } else { if (inputType == InputType.Password) { text = string.Empty; string str = "*"; if (label.bitmapFont != null && label.bitmapFont.bmFont != null && label.bitmapFont.bmFont.GetGlyph(42) == null) { str = "x"; } int i = 0; for (int length = value.Length; i < length; i++) { text += str; } } else { text = value; } int num = isSelected ? Mathf.Min(text.Length, cursorPosition) : 0; string str2 = text.Substring(0, num); if (isSelected) { str2 += Input.compositionString; } text = str2 + text.Substring(num, text.Length - num); if (isSelected && label.overflowMethod == UILabel.Overflow.ClampContent && label.maxLineCount == 1) { int num2 = label.CalculateOffsetToFit(text); if (num2 == 0) { mDrawStart = 0; RestoreLabelPivot(); } else if (num < mDrawStart) { mDrawStart = num; SetPivotToLeft(); } else if (num2 < mDrawStart) { mDrawStart = num2; SetPivotToLeft(); } else { num2 = label.CalculateOffsetToFit(text.Substring(0, num)); if (num2 > mDrawStart) { mDrawStart = num2; SetPivotToRight(); } } if (mDrawStart != 0) { text = text.Substring(mDrawStart, text.Length - mDrawStart); } } else { mDrawStart = 0; RestoreLabelPivot(); } } label.text = text; if (isSelected) { int num3 = mSelectionStart - mDrawStart; int num4 = mSelectionEnd - mDrawStart; if (mBlankTex == null) { mBlankTex = new Texture2D(2, 2, TextureFormat.ARGB32, mipmap: false); for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { mBlankTex.SetPixel(k, j, Color.white); } } mBlankTex.Apply(); } if (num3 != num4) { if (mHighlight == null) { mHighlight = NGUITools.AddWidget <UITexture>(label.cachedGameObject); mHighlight.name = "Input Highlight"; mHighlight.mainTexture = mBlankTex; mHighlight.fillGeometry = false; mHighlight.pivot = label.pivot; mHighlight.SetAnchor(label.cachedTransform); } else { mHighlight.pivot = label.pivot; mHighlight.mainTexture = mBlankTex; mHighlight.MarkAsChanged(); mHighlight.enabled = true; } } if (mCaret == null) { mCaret = NGUITools.AddWidget <UITexture>(label.cachedGameObject); mCaret.name = "Input Caret"; mCaret.mainTexture = mBlankTex; mCaret.fillGeometry = false; mCaret.pivot = label.pivot; mCaret.SetAnchor(label.cachedTransform); } else { mCaret.pivot = label.pivot; mCaret.mainTexture = mBlankTex; mCaret.MarkAsChanged(); mCaret.enabled = true; } if (num3 != num4) { label.PrintOverlay(num3, num4, mCaret.geometry, mHighlight.geometry, caretColor, selectionColor); mHighlight.enabled = mHighlight.geometry.hasVertices; } else { label.PrintOverlay(num3, num4, mCaret.geometry, null, caretColor, selectionColor); if (mHighlight != null) { mHighlight.enabled = false; } } mNextBlink = RealTime.time + 0.5f; mLastAlpha = label.finalAlpha; } else { Cleanup(); } } }
/// <summary> /// Update the visual text label. /// </summary> public void UpdateLabel() { if (label != null) { if (mDoInit) { Init(); } bool selected = isSelected; string fullText = value; bool isEmpty = string.IsNullOrEmpty(fullText) && string.IsNullOrEmpty(Input.compositionString); label.color = (isEmpty && !selected) ? mDefaultColor : activeTextColor; string processed; if (isEmpty) { processed = selected ? "" : mDefaultText; RestoreLabelPivot(); } else { if (inputType == InputType.Password) { processed = ""; string asterisk = "*"; if (label.bitmapFont != null && label.bitmapFont.bmFont != null && label.bitmapFont.bmFont.GetGlyph('*') == null) { asterisk = "x"; } for (int i = 0, imax = fullText.Length; i < imax; ++i) { processed += asterisk; } } else { processed = fullText; } // Start with text leading up to the selection int selPos = selected ? Mathf.Min(processed.Length, cursorPosition) : 0; string left = processed.Substring(0, selPos); // Append the composition string and the cursor character if (selected) { left += Input.compositionString; } // Append the text from the selection onwards processed = left + processed.Substring(selPos, processed.Length - selPos); // Clamped content needs to be adjusted further if (selected && label.overflowMethod == UILabel.Overflow.ClampContent && label.maxLineCount == 1) { // Determine what will actually fit into the given line int offset = label.CalculateOffsetToFit(processed); if (offset == 0) { mDrawStart = 0; RestoreLabelPivot(); } else if (selPos < mDrawStart) { mDrawStart = selPos; SetPivotToLeft(); } else if (offset < mDrawStart) { mDrawStart = offset; SetPivotToLeft(); } else { offset = label.CalculateOffsetToFit(processed.Substring(0, selPos)); if (offset > mDrawStart) { mDrawStart = offset; SetPivotToRight(); } } // If necessary, trim the front if (mDrawStart != 0) { processed = processed.Substring(mDrawStart, processed.Length - mDrawStart); } } else { mDrawStart = 0; RestoreLabelPivot(); } } label.text = processed; #if MOBILE if (selected && (mKeyboard == null || inputShouldBeHidden)) #else if (selected) #endif { int start = mSelectionStart - mDrawStart; int end = mSelectionEnd - mDrawStart; // Blank texture used by selection and caret if (mBlankTex == null) { mBlankTex = new Texture2D(2, 2, TextureFormat.ARGB32, false); for (int y = 0; y < 2; ++y) { for (int x = 0; x < 2; ++x) { mBlankTex.SetPixel(x, y, Color.white); } } mBlankTex.Apply(); } // Create the selection highlight if (start != end) { if (mHighlight == null) { mHighlight = NGUITools.AddWidget <UITexture>(label.cachedGameObject); mHighlight.name = "Input Highlight"; mHighlight.mainTexture = mBlankTex; mHighlight.fillGeometry = false; mHighlight.pivot = label.pivot; mHighlight.SetAnchor(label.cachedTransform); } else { mHighlight.pivot = label.pivot; mHighlight.mainTexture = mBlankTex; mHighlight.MarkAsChanged(); mHighlight.enabled = true; } } // Create the carter if (mCaret == null) { mCaret = NGUITools.AddWidget <UITexture>(label.cachedGameObject); mCaret.name = "Input Caret"; mCaret.mainTexture = mBlankTex; mCaret.fillGeometry = false; mCaret.pivot = label.pivot; mCaret.SetAnchor(label.cachedTransform); } else { mCaret.pivot = label.pivot; mCaret.mainTexture = mBlankTex; mCaret.MarkAsChanged(); mCaret.enabled = true; } if (start != end) { label.PrintOverlay(start, end, mCaret.geometry, mHighlight.geometry, caretColor, selectionColor); mHighlight.enabled = mHighlight.geometry.hasVertices; } else { label.PrintOverlay(start, end, mCaret.geometry, null, caretColor, selectionColor); if (mHighlight != null) { mHighlight.enabled = false; } } // Reset the blinking time mNextBlink = RealTime.time + 0.5f; mLastAlpha = label.finalAlpha; } else { Cleanup(); } } }
//Texture2D screenShot; void Awake() { controller = (ScreenshotController)UIManager.GetControler(UIName.SCREENSHOT_WIN); uiTexture = transform.Find("Container/Texture").gameObject.GetComponent <UITexture>(); }
//初始化控件变量 protected override void InitControls() { fastComponent = GetComponent <FastComponent>(); fastComponent.BuildFastComponents(); m__Icon = fastComponent.FastGetComponent <UITexture>("Icon"); if (null == m__Icon) { Engine.Utility.Log.Error("m__Icon 为空,请检查prefab是否缺乏组件"); } m_label_Name = fastComponent.FastGetComponent <UILabel>("Name"); if (null == m_label_Name) { Engine.Utility.Log.Error("m_label_Name 为空,请检查prefab是否缺乏组件"); } m_label_SellNum = fastComponent.FastGetComponent <UILabel>("SellNum"); if (null == m_label_SellNum) { Engine.Utility.Log.Error("m_label_SellNum 为空,请检查prefab是否缺乏组件"); } m_sprite_moneyIcon = fastComponent.FastGetComponent <UISprite>("moneyIcon"); if (null == m_sprite_moneyIcon) { Engine.Utility.Log.Error("m_sprite_moneyIcon 为空,请检查prefab是否缺乏组件"); } m_label_UnitPrice = fastComponent.FastGetComponent <UILabel>("UnitPrice"); if (null == m_label_UnitPrice) { Engine.Utility.Log.Error("m_label_UnitPrice 为空,请检查prefab是否缺乏组件"); } m_btn_Btn_Less = fastComponent.FastGetComponent <UIButton>("Btn_Less"); if (null == m_btn_Btn_Less) { Engine.Utility.Log.Error("m_btn_Btn_Less 为空,请检查prefab是否缺乏组件"); } m_btn_Btn_Add = fastComponent.FastGetComponent <UIButton>("Btn_Add"); if (null == m_btn_Btn_Add) { Engine.Utility.Log.Error("m_btn_Btn_Add 为空,请检查prefab是否缺乏组件"); } m_label_UnitNum = fastComponent.FastGetComponent <UILabel>("UnitNum"); if (null == m_label_UnitNum) { Engine.Utility.Log.Error("m_label_UnitNum 为空,请检查prefab是否缺乏组件"); } m_btn_Btn_Max = fastComponent.FastGetComponent <UIButton>("Btn_Max"); if (null == m_btn_Btn_Max) { Engine.Utility.Log.Error("m_btn_Btn_Max 为空,请检查prefab是否缺乏组件"); } m_sprite_moneyIcon2 = fastComponent.FastGetComponent <UISprite>("moneyIcon2"); if (null == m_sprite_moneyIcon2) { Engine.Utility.Log.Error("m_sprite_moneyIcon2 为空,请检查prefab是否缺乏组件"); } m_label_TotalPriceNum = fastComponent.FastGetComponent <UILabel>("TotalPriceNum"); if (null == m_label_TotalPriceNum) { Engine.Utility.Log.Error("m_label_TotalPriceNum 为空,请检查prefab是否缺乏组件"); } m_btn_Btn_Buy = fastComponent.FastGetComponent <UIButton>("Btn_Buy"); if (null == m_btn_Btn_Buy) { Engine.Utility.Log.Error("m_btn_Btn_Buy 为空,请检查prefab是否缺乏组件"); } m_btn_Btn_Canel = fastComponent.FastGetComponent <UIButton>("Btn_Canel"); if (null == m_btn_Btn_Canel) { Engine.Utility.Log.Error("m_btn_Btn_Canel 为空,请检查prefab是否缺乏组件"); } m_widget_ContainerBox = fastComponent.FastGetComponent <UIWidget>("ContainerBox"); if (null == m_widget_ContainerBox) { Engine.Utility.Log.Error("m_widget_ContainerBox 为空,请检查prefab是否缺乏组件"); } m_label_Title = fastComponent.FastGetComponent <UILabel>("Title"); if (null == m_label_Title) { Engine.Utility.Log.Error("m_label_Title 为空,请检查prefab是否缺乏组件"); } if (null != fastComponent) { GameObject.Destroy(fastComponent); } }
/// <summary> /// 创建视频. /// </summary> public void CreateVideo(MovieTexture varMovieTexture, UITexture varUITexture, bool varBool = false) { varUITexture.mainTexture = varMovieTexture; varMovieTexture.loop = varBool; }