|
@@ -10,17 +10,12 @@ namespace GFGGame
|
|
|
public class GuideView : BaseView
|
|
|
{
|
|
|
private UI_GuideUI _ui;
|
|
|
- private bool _needUpdate;
|
|
|
- private GObject guideTarget = null;
|
|
|
- private float devWidth;
|
|
|
- private float devHeight;
|
|
|
- private int yTxt;
|
|
|
- private bool showAni;
|
|
|
- private bool showEffect;
|
|
|
|
|
|
+ private GObject guideTarget = null;
|
|
|
private int guideId;
|
|
|
private int guideIndex;
|
|
|
- private bool isOptionalGuide = false;//弱引导,点击任意地方都可关闭
|
|
|
+ private bool justHint;//仅提示,不提示点击,无遮罩,点击任何地方可关闭引导
|
|
|
+ private float compTxtY = 0;//提示语位置
|
|
|
|
|
|
private GameObject _gameObject;
|
|
|
private GoWrapper _wrapper;
|
|
@@ -45,174 +40,137 @@ namespace GFGGame
|
|
|
this.viewCom = _ui.target;
|
|
|
this.layer = ConstViewLayer.GUIDE;
|
|
|
isfullScreen = true;
|
|
|
- _ui.m_rectFrameTemp.visible = false;
|
|
|
- _ui.m_rectFrame.target.visible = false;
|
|
|
- _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Width);
|
|
|
- _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Height);
|
|
|
- _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Left_Left);
|
|
|
- _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Top_Top);
|
|
|
- _ui.m_mask.target.onClick.Add(() =>
|
|
|
- {
|
|
|
- if (ViewManager.isViewOpen(typeof(RoleLvUpView).Name))
|
|
|
- {
|
|
|
- ViewManager.Hide(typeof(RoleLvUpView).Name);
|
|
|
- }
|
|
|
- if (isOptionalGuide) this.OnClickTarget();
|
|
|
- });
|
|
|
-
|
|
|
+ // _ui.m_rectFrameTemp.visible = false;
|
|
|
+ // _ui.m_rectFrame.target.visible = false;
|
|
|
+ // _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Width);
|
|
|
+ // _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Height);
|
|
|
+ // _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Left_Left);
|
|
|
+ // _ui.m_rectFrame.target.AddRelation(_ui.m_mask.m_guideArea, RelationType.Top_Top);
|
|
|
+ // _ui.m_mask.target.onClick.Add(() =>
|
|
|
+ // {
|
|
|
+ // if (ViewManager.isViewOpen(typeof(RoleLvUpView).Name))
|
|
|
+ // {
|
|
|
+ // ViewManager.Hide(typeof(RoleLvUpView).Name);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ _ui.m_loaMask.onClick.Add(OnClickTarget);
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- // GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.STUDIO_OPEN);
|
|
|
-
|
|
|
- // if (GuideDataManager.currentGuideId == cfg.id && GuideDataManager.currentGuideIdIndex == 1)
|
|
|
- // {
|
|
|
- // string resPath1 = ResPathUtil.GetViewEffectPath("ui_ck", "ui_ck_dj_2");
|
|
|
- // SceneController.AddObjectToView(_gameObject, _wrapper, _ui.m_comHolder.m_holder, resPath1, out _gameObject, out _wrapper);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // string resPath0 = ResPathUtil.GetViewEffectPath("ui_yd/ui_yd_y", "ui_yd_y");
|
|
|
- // SceneController.AddObjectToView(_gameObject, _wrapper, _ui.m_comHolder.m_holder, resPath0, out _gameObject, out _wrapper);
|
|
|
- // }
|
|
|
|
|
|
List<object> dataList = viewData as List<object>;
|
|
|
guideTarget = dataList[0] as GObject;
|
|
|
string txtContent = (string)dataList[1];
|
|
|
- yTxt = (int)dataList[2];
|
|
|
- isOptionalGuide = (bool)dataList[3];
|
|
|
- devWidth = (float)dataList[4];
|
|
|
- devHeight = (float)dataList[5];
|
|
|
|
|
|
- guideId = (int)dataList[6];
|
|
|
- guideIndex = (int)dataList[7];
|
|
|
- showAni = (bool)dataList[8];
|
|
|
- showEffect = (bool)dataList[9];
|
|
|
+ guideId = (int)dataList[2];
|
|
|
+ guideIndex = (int)dataList[3];
|
|
|
+ compTxtY = (float)dataList[4];
|
|
|
|
|
|
- if (txtContent != null && txtContent.Length > 0)
|
|
|
- {
|
|
|
- _ui.m_compTxt.m_txt.text = txtContent;
|
|
|
- if (this._ui.m_compTxt.m_txt.textHeight > this._ui.m_compTxt.m_txt.textFormat.size * 2)
|
|
|
- {
|
|
|
- this._ui.m_compTxt.m_txt.align = AlignType.Left;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- this._ui.m_compTxt.m_txt.align = AlignType.Center;
|
|
|
- }
|
|
|
- _ui.m_compTxt.target.visible = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _ui.m_compTxt.target.visible = false;
|
|
|
- }
|
|
|
- _ui.m_comHolder.target.visible = false;
|
|
|
- _ui.m_rectFrameTemp.width = _ui.m_mask.target.width;
|
|
|
- _ui.m_rectFrameTemp.height = _ui.m_mask.target.height;
|
|
|
- _ui.m_rectFrameTemp.x = 0;
|
|
|
- _ui.m_rectFrameTemp.y = 0;
|
|
|
- _ui.m_rectFrameTemp.visible = showAni;
|
|
|
|
|
|
- GRoot.inst.touchable = true;
|
|
|
+ // GRoot.inst.touchable = true;
|
|
|
MainDataManager.Instance.CanSwipe = false;
|
|
|
|
|
|
+ UpdateComTxt(txtContent);
|
|
|
+ _ui.m_comHolder.target.visible = false;
|
|
|
+ _ui.m_mask.target.visible = false;
|
|
|
+ _ui.m_loaMask.visible = false;
|
|
|
if (guideTarget != null)
|
|
|
{
|
|
|
|
|
|
- UpdateGuideRect();
|
|
|
Timers.inst.AddUpdate(UpdateGuideRect);
|
|
|
+ _ui.m_comHolder.target.visible = true;
|
|
|
_ui.m_mask.target.visible = true;
|
|
|
- _ui.m_mask.m_guideArea.visible = false;
|
|
|
guideTarget.onClick.Add(OnClickTarget);
|
|
|
- if (guideTarget == null) OnClickTarget();
|
|
|
-
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _ui.m_comHolder.target.visible = false;
|
|
|
- _ui.m_mask.target.visible = false;
|
|
|
- _ui.m_rectFrameTemp.visible = false;
|
|
|
-
|
|
|
- }
|
|
|
- if (!showEffect)
|
|
|
- {
|
|
|
- _ui.m_comHolder.target.visible = showEffect;
|
|
|
+ _ui.m_loaMask.visible = true;
|
|
|
+ if (compTxtY > 0)
|
|
|
+ {
|
|
|
+ _ui.m_compTxt.target.y = compTxtY;
|
|
|
+ }
|
|
|
}
|
|
|
- _ui.m_compTxt.target.y = Math.Min(yTxt, GRoot.inst.height - _ui.m_compTxt.target.height - 3);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
- Timers.inst.Remove(UpdateGuideRect);
|
|
|
+
|
|
|
base.OnHide();
|
|
|
- if (!isOptionalGuide && guideTarget == null)
|
|
|
+ guideTarget = null;
|
|
|
+ Timers.inst.Remove(UpdateGuideRect);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateComTxt(string txtContent)
|
|
|
+ {
|
|
|
+ if (String.IsNullOrEmpty(txtContent))
|
|
|
{
|
|
|
- OnClickTarget();
|
|
|
+ _ui.m_compTxt.target.visible = false;
|
|
|
}
|
|
|
- guideTarget = null;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _ui.m_compTxt.m_txt.text = txtContent;
|
|
|
+ if (this._ui.m_compTxt.m_txt.textHeight > this._ui.m_compTxt.m_txt.textFormat.size * 2)
|
|
|
+ {
|
|
|
+ this._ui.m_compTxt.m_txt.align = AlignType.Left;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this._ui.m_compTxt.m_txt.align = AlignType.Center;
|
|
|
+ }
|
|
|
+ _ui.m_compTxt.target.visible = true;
|
|
|
|
|
|
+ this._ui.m_compTxt.m_txtBg.height = this._ui.m_compTxt.m_txtBg.initHeight;
|
|
|
+ if (this._ui.m_compTxt.m_txt.textHeight > this._ui.m_compTxt.m_txt.textFormat.size * 3)
|
|
|
+ {
|
|
|
+ this._ui.m_compTxt.m_txtBg.height = this._ui.m_compTxt.m_txtBg.height + this._ui.m_compTxt.m_txt.textFormat.size;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void UpdateGuideRect(object param = null)
|
|
|
{
|
|
|
if (guideTarget != null)
|
|
|
{
|
|
|
-
|
|
|
- Rect rect = guideTarget.TransformRect(new Rect(0 + devWidth, devHeight, guideTarget.width, guideTarget.height), _ui.target);
|
|
|
-
|
|
|
- _ui.m_mask.m_guideArea.size = new Vector2((int)rect.size.x, (int)rect.size.y);
|
|
|
- _ui.m_mask.m_guideArea.position = new Vector2((int)rect.position.x, (int)rect.position.y);
|
|
|
-
|
|
|
- _ui.m_comHolder.target.position = _ui.m_mask.m_guideArea.position;
|
|
|
- _ui.m_comHolder.target.size = _ui.m_mask.m_guideArea.size;
|
|
|
- int padding = 90;
|
|
|
- bool atBottom = _ui.m_mask.m_guideArea.y + _ui.m_mask.m_guideArea.height + padding + _ui.m_compTxt.target.height + padding > GRoot.inst.height;
|
|
|
- if (yTxt == 0)
|
|
|
+ Vector2 pos = guideTarget.LocalToGlobal(Vector2.zero);
|
|
|
+ pos.x = pos.x + guideTarget.width / 2;
|
|
|
+ pos.y = pos.y + guideTarget.height / 2;
|
|
|
+ if (_ui.m_mask.m_guideArea.xy == pos)
|
|
|
{
|
|
|
- if (atBottom)
|
|
|
- {
|
|
|
- _ui.m_compTxt.target.y = _ui.m_mask.m_guideArea.y - _ui.m_compTxt.target.height - padding;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _ui.m_compTxt.target.y = _ui.m_mask.m_guideArea.y + _ui.m_mask.m_guideArea.height + padding;
|
|
|
- }
|
|
|
+ Timers.inst.Remove(UpdateGuideRect);
|
|
|
+ return;
|
|
|
}
|
|
|
- int targetWidth = 20;
|
|
|
+ _ui.m_mask.m_guideArea.SetXY(pos.x, pos.y);
|
|
|
+ _ui.m_comHolder.target.position = _ui.m_mask.m_guideArea.position;
|
|
|
|
|
|
- if (showAni)
|
|
|
+ if (pos.x > GRoot.inst.width / 2)
|
|
|
+ {
|
|
|
+ _ui.m_comHolder.m_c1.selectedIndex = 0;//手在左边
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
+ _ui.m_comHolder.m_c1.selectedIndex = 1;//手在右边
|
|
|
+ }
|
|
|
|
|
|
- if (Mathf.Abs(_ui.m_rectFrameTemp.width - _ui.m_rectFrame.target.width) > targetWidth && Mathf.Abs(_ui.m_rectFrameTemp.height - _ui.m_rectFrame.target.height) > targetWidth)
|
|
|
- {
|
|
|
- // _ui.m_rectFrameTemp.visible = showAni;
|
|
|
- float duration = 0.5f;
|
|
|
- _ui.m_rectFrameTemp.TweenResize(new Vector2(_ui.m_rectFrame.target.width, _ui.m_rectFrame.target.height), duration);
|
|
|
- _ui.m_rectFrameTemp.TweenMove(new Vector2(_ui.m_rectFrame.target.x, _ui.m_rectFrame.target.y), duration);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- _ui.m_comHolder.target.visible = true;
|
|
|
- _ui.m_rectFrameTemp.visible = false;
|
|
|
- _ui.m_mask.m_guideArea.visible = true;
|
|
|
-
|
|
|
- }
|
|
|
+ int padding = 200;
|
|
|
+ if (pos.y < GRoot.inst.height - 700)
|
|
|
+ {
|
|
|
+ _ui.m_compTxt.target.y = pos.y + padding;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _ui.m_comHolder.target.visible = true;
|
|
|
- _ui.m_mask.m_guideArea.visible = true;
|
|
|
+ _ui.m_compTxt.target.y = pos.y - padding - _ui.m_compTxt.target.height;
|
|
|
}
|
|
|
- if (!showEffect)
|
|
|
+ if (compTxtY > 0)
|
|
|
{
|
|
|
- _ui.m_comHolder.target.visible = showEffect;
|
|
|
+ _ui.m_compTxt.target.y = compTxtY;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
private void OnClickTarget()
|
|
|
{
|
|
|
if (guideTarget != null) guideTarget.onClick.Remove(OnClickTarget);
|