AppManager.cs
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using UnityEngine;
using System.Collections;
public class AppManager : Singleton<AppManager>
{
public ServerCanvasManager serverCanvas;
public AppSettings appSettings;
public void SpawnServerCanvas()
{
Instantiate(serverCanvas);
}
public void DestroyServerCanvas()
{
if (serverCanvas != null)
Destroy(serverCanvas.gameObject);
}
public void TweenCanvasGroup(CanvasGroup group, float alpha, float time)
{
TweenCanvasGroup(group, alpha, time, null);
}
public void TweenCanvasGroup(CanvasGroup group, float alpha, float time, System.Action onComplete)
{
iTween.Stop(group.gameObject);
Hashtable hash = new Hashtable()
{
{ "from", group.alpha },
{ "to", alpha },
{ "time", time },
{ "onupdate", (System.Action<object>)(x => group.alpha = (float) x) }
};
if (onComplete != null)
hash.Add("oncomplete", (System.Action<object>)(x => onComplete()));
iTween.ValueTo(group.gameObject, hash);
}
}