加确认框。按钮加tooltips。调整大地图tips的位置。
This commit is contained in:
1 parent
bb4fabc833
commit
1c712ff7d5
18 files changed
+2401
-520
No files matched your search
@@ -42,7 +42,7 @@ public class Tips : MonoBehaviour
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
Name = this.transform.Find("Name").GetComponent<Text>();
|
||||
Count = this.transform.Find("Count").GetComponent<Text>();
|
||||
Count = this.transform.Find("CountWrap").Find("Count").GetComponent<Text>();
|
||||
Distance = this.transform.Find("Distance").GetComponent<Text>();
|
||||
TotalClimb = this.transform.Find("TotalClimb").GetComponent<Text>();
|
||||
|
||||
@@ -115,7 +115,6 @@ public class Tips : MonoBehaviour
|
||||
|
||||
m3DIcon.SetActive(_model.Enable3D);
|
||||
|
||||
|
||||
//altitudeGraph
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, altitudeGraph, _model.AltitudeGraph);
|
||||
@@ -129,31 +128,52 @@ public class Tips : MonoBehaviour
|
||||
//{
|
||||
// position.y = position.z;
|
||||
//}
|
||||
this.transform.position = position;
|
||||
|
||||
var localPosition = this.transform.localPosition;
|
||||
if (localPosition.y + 150 > localPosition.z)
|
||||
{
|
||||
localPosition.y = localPosition.z -150;
|
||||
}
|
||||
if(localPosition.x * -1f > localPosition.z)
|
||||
{
|
||||
localPosition.x = localPosition.z * -1f;
|
||||
}
|
||||
else if(localPosition.x > localPosition.z *2)
|
||||
{
|
||||
localPosition.x = localPosition.z * 2;
|
||||
}
|
||||
this.transform.localPosition = localPosition;
|
||||
this.transform.localScale = new Vector2(2, 2);
|
||||
this.Move(position);
|
||||
|
||||
//tips.Show();
|
||||
this.gameObject.SetActive(true);
|
||||
|
||||
this.SetModel(model);
|
||||
}
|
||||
|
||||
public void Move(Vector3 position)
|
||||
{
|
||||
this.transform.position = position;
|
||||
|
||||
var localPosition = this.transform.localPosition;
|
||||
Debug.Log(localPosition.y);
|
||||
if(localPosition.y > 128)
|
||||
{
|
||||
localPosition.y = 128;
|
||||
}
|
||||
if(localPosition.x < -465)
|
||||
{
|
||||
localPosition.x = -465f;
|
||||
}
|
||||
if(localPosition.x > 1080)
|
||||
{
|
||||
localPosition.x = 1080;
|
||||
}
|
||||
//if (localPosition.y + 150 > localPosition.z)
|
||||
//{
|
||||
// localPosition.y = localPosition.z -150;
|
||||
//}
|
||||
//if(localPosition.x * -1f > localPosition.z)
|
||||
//{
|
||||
// localPosition.x = localPosition.z * -1f;
|
||||
//}
|
||||
//else if(localPosition.x > localPosition.z *2)
|
||||
//{
|
||||
// localPosition.x = localPosition.z * 2;
|
||||
//}
|
||||
this.transform.localPosition = localPosition;
|
||||
this.transform.localScale = new Vector2(2, 2);
|
||||
|
||||
Debug.Log($"{ this.transform.localPosition.y }, { this.transform.localPosition.y }");
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
//this.gameObject.SetActive(false);
|
||||
DestroyImmediate(this.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using System;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class Confirm : PFUIPanel
|
||||
{
|
||||
private PFUIText _title;
|
||||
private PFUIText _content;
|
||||
private PfUIButton _ok;
|
||||
private UnityAction _callback;
|
||||
private PfUIButton _cancel;
|
||||
protected override void Awake()
|
||||
{
|
||||
//var rect = this.gameObject.AddComponent<RectTransform>();
|
||||
//var layout = this.gameObject.AddComponent<VerticalLayoutGroup>();
|
||||
//layout.spacing = 20f;
|
||||
//layout.childAlignment = TextAnchor.MiddleCenter;
|
||||
|
||||
var wrap = this.transform.Find("GameObject");
|
||||
_title = wrap.Find("Title").GetComponent<PFUIText>();
|
||||
_content = wrap.Find("Content").GetComponent<PFUIText>();
|
||||
//text.transform.SetParent(layout.transform);
|
||||
//text.text = "阿斯达克法拉盛地方";
|
||||
///text = layout.transform.GetChild(0).gameObject.AddComponent<Text>();
|
||||
|
||||
//text = GetComponentInChildren<Transform>().gameObject.AddComponent<Text>();
|
||||
|
||||
_ok = wrap.Find("Ok").GetComponent<PfUIButton>();
|
||||
_cancel = wrap.Find("Cancel").GetComponent<PfUIButton>();
|
||||
//button.onClick.AddListener(() =>
|
||||
//{
|
||||
// this.Close();
|
||||
// //this.Destroy(true);
|
||||
// //DestroyImmediate(this);
|
||||
//});
|
||||
UIManager.AddEvent(_ok.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback();
|
||||
}
|
||||
});
|
||||
UIManager.AddEvent(_cancel.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
this.Close();
|
||||
});
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Set(string title, string content, UnityAction callback)
|
||||
{
|
||||
//if(text == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//text.text = txt;
|
||||
_title.Text = title;
|
||||
_content.Text = content;
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var panel = this.transform.Find("Panel");
|
||||
var bg = panel.GetComponent<Image>();
|
||||
//bg.alphaHitTestMinimumThreshold
|
||||
|
||||
var color = bg.color;
|
||||
color.a = 0.6f;
|
||||
bg.color = color;
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
var panel = this.transform.Find("Panel");
|
||||
var bg = panel.GetComponent<Image>();
|
||||
|
||||
bg.DOFade(0, 0.2f).OnComplete(() =>
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6618e32f03c775a4b9bf59d1da2a8d24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -35,7 +35,9 @@ public class MainNav : MonoBehaviour
|
||||
|
||||
UIManager.AddEvent(exit, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
Application.Quit();
|
||||
UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", ()=> {
|
||||
Application.Quit();
|
||||
});
|
||||
});
|
||||
|
||||
UIManager.AddEvent(transform.Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
|
||||
|
||||
@@ -30,7 +30,23 @@ public class BigMapController : PFUIPanel
|
||||
UnityEngine.Object begin;
|
||||
Sprite end;
|
||||
private Dictionary<int, LineItem> linesCache = new Dictionary<int, LineItem>();
|
||||
Tips tips;
|
||||
UnityEngine.Object tipsObject;
|
||||
private Tips _tips;
|
||||
private Tips tips
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tips == null)
|
||||
{
|
||||
_tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
|
||||
}
|
||||
return _tips;
|
||||
}
|
||||
set
|
||||
{
|
||||
_tips = value;
|
||||
}
|
||||
}
|
||||
int timer = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
@@ -76,8 +92,9 @@ public class BigMapController : PFUIPanel
|
||||
var searchBtn = input.Find("Search").gameObject;
|
||||
UIManager.AddEvent(searchBtn, EventTriggerType.PointerClick, Search);
|
||||
|
||||
tips = ((GameObject)Instantiate(Resources.Load("UI/Prefab/BigMap/Tips"), canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
|
||||
tips.Hide();
|
||||
tipsObject = Resources.Load("UI/Prefab/BigMap/Tips");
|
||||
//tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
|
||||
//tips.Hide();
|
||||
|
||||
BindHeadImage();
|
||||
}
|
||||
@@ -228,6 +245,7 @@ public class BigMapController : PFUIPanel
|
||||
if(item.Value.Selected)
|
||||
{
|
||||
tips.Hide();
|
||||
tips = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,11 +307,16 @@ public class BigMapController : PFUIPanel
|
||||
line.Item = iii;
|
||||
iii.onClick = () =>
|
||||
{
|
||||
if(tips != null)
|
||||
{
|
||||
tips.Hide();
|
||||
tips = null;
|
||||
}
|
||||
if (line.Selected)
|
||||
{
|
||||
line.Selected = false;
|
||||
tips.Hide();
|
||||
//iii.Selected(false);
|
||||
//tips.Hide();
|
||||
//tips = null;
|
||||
return;
|
||||
}
|
||||
line.Selected = true;
|
||||
@@ -360,7 +383,8 @@ public class BigMapController : PFUIPanel
|
||||
line.Selected = true;
|
||||
var position = line.BeginMarker.transform.position;
|
||||
//position.z += 25;
|
||||
tips.Show(position, line.Model);
|
||||
//tips.Show(position, line.Model);
|
||||
tips.Move(position);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -57,10 +58,11 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
|
||||
userInfo.Find("BtnMore").GetComponent<PfUIButton>().SetEnabled(false);
|
||||
UIManager.AddEvent(userInfo.Find("BtnMore").gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowAlert("test");
|
||||
//UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", null);
|
||||
});
|
||||
GetSummary();
|
||||
}
|
||||
@@ -156,7 +158,6 @@ public class HomeController : PFUIPanel
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user