void Awake() { GetComponent <M4uContextRoot>().Context = this; m_CanvasSetting = GetComponentInChildren <CanvasSetting>(); m_CarouselRotator = GetComponentInChildren <CarouselRotator>(); m_CarouselToggler = GetComponentInChildren <CarouselToggler>(); AndroidBackKeyManager.Instance.StackPush(gameObject, OnClickCloseButton); }
private void updateUV() { if (TargetImage.texture == null) { return; } //テクスチャサイズ float tw = TargetImage.texture.width; float th = TargetImage.texture.height; //float tw_half = tw * 0.5f; float th_half = th * 0.5f; //オブジェクト位置 RectTransform rectObjTrans = GetComponent <RectTransform>(); Vector2 o_pos = RectTransformUtility.WorldToScreenPoint(MainCamera, rectObjTrans.position); //オブジェクトサイズ float ow = rectObjTrans.sizeDelta.x; float oh = rectObjTrans.sizeDelta.y; float ow_half = ow * 0.5f; float oh_half = oh * 0.5f; //スクリーンサイズ float sw = MainCamera.pixelWidth; float sh = MainCamera.pixelHeight; //float sw_half = sw * 0.5f; float sh_half = sh * 0.5f; CanvasSetting canvasSetting = MainCanvas.GetComponent <CanvasSetting>(); if (!canvasSetting.IsHeightReference) { float rate = DefaultCanvasSizeX / sw; o_pos *= rate; float tmp0 = (sh_half * rate) - th_half; Vector2 o_pos_lu = new Vector2(o_pos.x - ow_half, o_pos.y - oh_half - tmp0); TargetImage.uvRect = new Rect(o_pos_lu.x / tw, o_pos_lu.y / th, ow / tw, oh / th); } else { float rate = DefaultCanvasSizeY / sh; o_pos *= rate; float tmp0 = (sh_half * rate) - th_half; Vector2 o_pos_lu = new Vector2(o_pos.x - ow_half, o_pos.y - oh_half - tmp0); TargetImage.uvRect = new Rect((o_pos_lu.x + (canvasSetting.GetAddWidth() * 0.5f)) / tw, o_pos_lu.y / th, ow / tw, oh / th); } #if UNITY_EDITOR TargetImage.OnRebuildRequested(); #endif }
/// <summary> /// Pivotが中央でないとうまく調整されない /// </summary> /// <param name="_pos">Anchored Position</param> /// <param name="_size">Size Delta</param> public void SetPositionAjustStatusBar(Vector2 _pos, Vector2 _size) { RectTransform trans = GetComponent <RectTransform>(); if (trans == null) { return; } float bar_height = 0.0f; float bar_height_half = 0.0f; float bottom_height = 0.0f; float bottom_height_half = 0.0f; if (SafeAreaControl.HasInstance) { float bottom_space_height = SafeAreaControl.Instance.bottom_space_height; bar_height = (float)(SafeAreaControl.Instance.bar_height * -1); bar_height_half = bar_height * 0.5f; bottom_height = (float)(bottom_space_height * -1); bottom_height_half = bottom_height * 0.5f; } if (trans.pivot.x == 1.0f && trans.pivot.y == 1.0f) { CanvasSetting _setting = GetComponentInParent <CanvasSetting>(); if (_setting != null) { trans.anchoredPosition = new Vector2(_pos.x + _setting.GetAddWidth() / 2.0f, _pos.y + bar_height); trans.sizeDelta = new Vector2(_size.x + _setting.GetAddWidth(), _size.y + bar_height + bottom_height); } else { trans.anchoredPosition = new Vector2(_pos.x, _pos.y + bar_height); trans.sizeDelta = new Vector2(_size.x, _size.y + bar_height + bottom_height); } } else { trans.anchoredPosition = new Vector2(_pos.x, _pos.y + bar_height_half - bottom_height_half); CanvasSetting _setting = GetComponentInParent <CanvasSetting>(); if (_setting != null) { trans.sizeDelta = new Vector2(_size.x + _setting.GetAddWidth(), _size.y + bar_height + bottom_height); } else { trans.sizeDelta = new Vector2(_size.x, _size.y + bar_height + bottom_height); } } }
//ページ初期化処理 protected override void PageSwitchSetting(bool initalize) { base.PageSwitchSetting(initalize); // 表示をダイアログと同じにする CanvasSetting canvasSetting = m_CanvasObj.GetComponent <CanvasSetting>(); if (canvasSetting != null) { canvasSetting.ChangeLayerType(CanvasSetting.LayerType.DIALOG); } m_BeginnerBoost = GetComponentInChildren <BeginnerBoost>(); //m_BeginnerBoost.SetSizeParfect(new Vector2(0, -395)); // シーンの最後に呼び出す m_BeginnerBoost.PostSceneStart(); }
//------------------------------------------------------------------------------------------------- // // // //------------------------------------------------------------------------------------------------- public static UnitResult Create(ResultType _type) { //ユニット詳細は1つしか開かない if (GetUnitResult() != null) { return(null); } GameObject _tmpObj = Resources.Load("Prefab/UnitResult2/UnitResult") as GameObject; if (_tmpObj == null) { return(null); } GameObject _insObj = Instantiate(_tmpObj) as GameObject; if (_insObj == null) { return(null); } UnitResult unitResult = _insObj.GetComponent <UnitResult>(); unitResult.setup(_type); if (unitResult.m_Type == ResultType.Link) { if (unitResult.m_Canvas != null) { CanvasSetting canvasSetting = unitResult.m_Canvas.GetComponent <CanvasSetting>(); if (canvasSetting != null) { canvasSetting.ChangeLayerType(CanvasSetting.LayerType.DIALOG); } LoadingManager.Instance.setOverLayMask(true); } } UnityUtil.SetObjectEnabledOnce(_insObj, true); return(unitResult); }
public void SetSizeParfect(Vector2 _size) { RectTransform trans = GetComponent <RectTransform>(); if (trans == null) { return; } CanvasSetting _setting = GetComponentInParent <CanvasSetting>(); if (_setting != null) { trans.sizeDelta = new Vector2(_size.x + _setting.GetAddWidth(), _size.y); } else { trans.sizeDelta = new Vector2(_size.x, _size.y); } }
static FileDiskCacheManagerFactory() { CanvasSetting setting = null; string fname = Path.Combine(Path.GetDirectoryName((new TileSetting()).GetType().Assembly.Location), "GeoDo.RSS.Core.DrawEngine.GDIPlus.cnfg.xml"); if (File.Exists(fname)) { using (CanvasSettingParser p = new CanvasSettingParser()) { setting = p.Parse(fname); if (!Directory.Exists(setting.CacheSetting.Dir)) { Directory.CreateDirectory(setting.CacheSetting.Dir); } _tileSetting = setting.TileSetting; _cacheSetting = setting.CacheSetting; } } _fileIndexer = new FileIndexer(setting.CacheSetting.Dir);; }
public void SetPosition(Vector2 _pos, Vector2 _size, bool Ignore = false) { RectTransform trans = GetComponent <RectTransform>(); if (trans == null) { return; } trans.anchoredPosition = new Vector2(_pos.x, _pos.y); CanvasSetting _setting = GetComponentInParent <CanvasSetting>(); if (_setting != null && Ignore == false) { trans.sizeDelta = new Vector2(_size.x + _setting.GetAddWidth(), _size.y); } else { trans.sizeDelta = new Vector2(_size.x, _size.y); } }
public void HideCanvasSetting() { CanvasSetting.GetComponent <CanvasGroup>().alpha = 0; CanvasSetting.GetComponent <CanvasGroup>().blocksRaycasts = false; }
public void ShowCanvasSetting() { //GameSelected (); CanvasSetting.GetComponent <CanvasGroup>().alpha = 1; CanvasSetting.GetComponent <CanvasGroup>().blocksRaycasts = true; }