Pull down popup from common.
This commit is contained in:
@@ -9,14 +9,6 @@ namespace Cryville.Common.Unity {
|
||||
return (num2 & num) == num;
|
||||
}
|
||||
|
||||
public static void ShowException(Exception ex) {
|
||||
ShowMessageBox(ex.ToString());
|
||||
}
|
||||
|
||||
public static void ShowMessageBox(string message) {
|
||||
GameObject.Instantiate<GameObject>(Resources.Load<GameObject>("Common/Popup")).GetComponent<Popup>().Message = message;
|
||||
}
|
||||
|
||||
public static void Purge(Transform obj) {
|
||||
foreach (Transform i in obj)
|
||||
GameObject.Destroy(i.gameObject);
|
||||
|
@@ -1,34 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Common.Unity {
|
||||
public class Popup : MonoBehaviour {
|
||||
|
||||
public string Message = "";
|
||||
|
||||
LayoutElement layout;
|
||||
|
||||
float timer = 0;
|
||||
|
||||
const float DURATION = 5.0f;
|
||||
const float DURIN = 0.4f;
|
||||
const float DUROUT = 0.4f;
|
||||
const float HEIGHT = 50f;
|
||||
|
||||
#pragma warning disable IDE0051
|
||||
void Start() {
|
||||
layout = GetComponent<LayoutElement>();
|
||||
GetComponentInChildren<Text>().text = Message;
|
||||
transform.SetParent(GameObject.Find("PopupList").transform);
|
||||
layout.minHeight = 0;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (timer <= DURIN) layout.minHeight = timer / DURIN * HEIGHT;
|
||||
else if (timer >= DURATION) GameObject.Destroy(gameObject);
|
||||
else if (timer >= DURATION - DUROUT) layout.minHeight = (DURATION - timer) / DUROUT * HEIGHT;
|
||||
timer += Time.deltaTime;
|
||||
}
|
||||
#pragma warning restore IDE0051
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b4b06c6db17f5a498bf12bb00aa07cf
|
||||
timeCreated: 1608801352
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -133,10 +133,10 @@ namespace Cryville.Common.Unity {
|
||||
prop.SetValue(Target, v, new object[]{ });
|
||||
}
|
||||
catch (TargetInvocationException ex) {
|
||||
CallHelper.ShowMessageBox(ex.InnerException.Message);
|
||||
// CallHelper.ShowMessageBox(ex.InnerException.Message);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
CallHelper.ShowMessageBox(ex.Message);
|
||||
// CallHelper.ShowMessageBox(ex.Message);
|
||||
}
|
||||
}
|
||||
UpdateValue();
|
||||
|
Reference in New Issue
Block a user