public IEnumerator HideOldRoleBody(BaibianType type) { if (_roleDidi == null) { yield break; } if (type == BaibianType.none) { cameraFollow.follow1 = null; cameraFollow.follow2 = null; StopSound(); } var tween1 = DOTween.ToAlpha(() => _roleDidi.color, x => _roleDidi.color = x, 0, FADE_TIME); var tween2 = DOTween.ToAlpha(() => _roleJiejie.color, x => _roleJiejie.color = x, 0, FADE_TIME); while (tween1.IsPlaying() || tween2.IsPlaying()) { yield return(null); } _roleDidi.HideOldRoleBody(type); _roleDidi.gameObject.SetActive(false); _roleJiejie.HideOldRoleBody(type); _roleJiejie.gameObject.SetActive(false); }
public void Show(BaibianType baibianType, MenuItemType type, System.Action closeCallback = null) { _closeCallback = closeCallback; int value = (int)baibianType; if (type == MenuItemType.宝宝存钱罐) { gege.SetActive(false); jiejie.SetActive(false); jiejieZunqianguan.SetActive(true); } else { gege.SetActive(value % 2 != 0); jiejie.SetActive(value % 2 == 0); jiejieZunqianguan.SetActive(false); } gameObject.SetActive(true); if (menuStrs.ContainsKey(type)) { text.text = ""; text.fontSize = 36; var str = menuStrs[type]; _textTweener = text.DOText(str, 3f); _textTweener.SetEase(Ease.Linear); } else { text.text = ""; } }
public void Change(BaibianType type, bool force = false) { if (!_isChanging) { StartCoroutine(DoChange(type, force)); } }
Body GetBody(BaibianType type, out Vector3 pos, out Quaternion rot, out Vector3 scale) { Body ins; if (!_navCache.TryGetValue(type, out ins)) { var prefab = Resources.Load <Body>(GetBodyPath(type)); ins = Instantiate(prefab); ins.transform.SetParent(transform, false); _navCache[type] = ins; pos = prefab.transform.localPosition; _posCache[type] = pos; rot = prefab.transform.localRotation; _rotCache[type] = rot; scale = prefab.transform.localScale; _scaleCache[type] = scale; } else { pos = _posCache[type]; rot = _rotCache[type]; scale = _scaleCache[type]; } return(ins); }
public IEnumerator ReadyNewRoleBody(BaibianType type) { if (type == BaibianType.none) { yield break; } if (_roleDidi == null) { _roleDidi = Role.CreateDidi(); } if (_roleJiejie == null) { _roleJiejie = Role.CreateJiejie(); } _roleDidi.agent.map = _curNav; _roleDidi.ShowNewRoleBody(type); _roleDidi.gameObject.SetActive(true); _roleJiejie.ShowNewRoleBody(type); _roleJiejie.gameObject.SetActive(true); cameraFollow.follow1 = _roleDidi.cameraFollow; cameraFollow.follow2 = _roleJiejie.cameraFollow; _roleDidi.alpha = 0f; _roleJiejie.alpha = 0f; }
TypeZimu GetZimu(BaibianType type) { foreach (var item in typeZimus) { if (item.type == type) { return(item); } } return(null); }
public IEnumerator ChangeBgfg(BaibianType type) { StopSound(); StopZimu(); yield return(HideOldRoleBody(type)); if (_curBgfg) { _curBgfg["chuxian"].speed = -1f; _curBgfg["chuxian"].normalizedTime = 1f; _curBgfg.Play("chuxian"); while (_curBgfg.isPlaying) { yield return(null); } _curBgfg.gameObject.SetActive(false); } yield return(ReadyNewRoleBody(type)); _curBgfg = GetBgfg(type); if (_curBgfg) { _curBgfg.gameObject.SetActive(true); _curBgfg["chuxian"].normalizedTime = 0f; _curBgfg["chuxian"].speed = 1; _curBgfg.Play("chuxian"); while (_curBgfg.isPlaying) { yield return(null); } _curBgfg.Play("stand"); } yield return(ShowNewRoleBody(type)); if (type != BaibianType.none) { //HideJiejieTip(); //uiDuihuakuang.Show(type, ShowJiejieTip); foreach (var item in uiGuocheng.menus) { if (item.type == type) { PlaySound(item.audioClip); PlayZimu(type); break; } } } else { StopZimu(); } }
public void ChangeNav(BaibianType type) { if (_curNav) { _curNav.gameObject.SetActive(false); } _curNav = GetNav(type); if (_curNav) { _curNav.gameObject.SetActive(true); } }
public void HideOldRoleBody(BaibianType type) { if (_curBody) { if (agent) { agent.Stop(); } _curBody.gameObject.SetActive(false); _curBody = null; } }
public void TypeButtonDown(BaseEventData data, BaibianType type, RectTransform trans, Vector3 startLocalPos) { if (!_isChanging && _typeButtonPointer == null) { _typeButtonPointer = (PointerEventData)data; _typeButtonSelect = trans; _typeButtonType = type; _typeButtonStartPosition = trans.parent.TransformPoint(startLocalPos); if (_shouyeJiantou) { _shouyeJiantou.SetActive(true); } } }
// zimu void PlayZimu(BaibianType type) { var zimus = GetZimu(type); if (zimus == null) { StopZimu(); return; } spriteZimu.color = new Color(1f, 1f, 1f, 0f); spriteZimu.gameObject.SetActive(true); spriteZimu.StopAllCoroutines(); spriteZimu.StartCoroutine(DoZimu(zimus)); }
public IEnumerator ShowNewRoleBody(BaibianType type) { if (type == BaibianType.none) { yield break; } var tween1 = DOTween.ToAlpha(() => _roleDidi.color, x => _roleDidi.color = x, 1, FADE_TIME); var tween2 = DOTween.ToAlpha(() => _roleJiejie.color, x => _roleJiejie.color = x, 1, FADE_TIME); while (tween1.IsPlaying() || tween2.IsPlaying()) { yield return(null); } }
Animation GetBgfg(BaibianType type) { if (type == BaibianType.none) { return(null); } Animation anim; if (!_bgfgCache.TryGetValue(type, out anim)) { anim = Instantiate(Resources.Load <Animation>("baibian/world/bgfg/bgfg_" + type.ToString())); anim.transform.SetParent(bgfg, false); _bgfgCache[type] = anim; } return(anim); }
PolyNav2D GetNav(BaibianType type) { if (type == BaibianType.none) { return(null); } PolyNav2D ins; if (!_navCache.TryGetValue(type, out ins)) { ins = Instantiate(Resources.Load <PolyNav2D>("baibian/nav/nav_" + type.ToString())); ins.transform.SetParent(nav, false); _navCache[type] = ins; } return(ins); }
IEnumerator DoChange(BaibianType type, bool force = false) { _isChanging = true; var isNone = type == BaibianType.none; uiGuocheng.gameObject.SetActive(!isNone); if (_baibianType != type || force) { _baibianType = type; ChangeNav(type); yield return(ChangeBgfg(type)); if (isNone) { uiShouye.Show(); } } _isChanging = false; }
public void ShowNewRoleBody(BaibianType type) { Vector3 pos; Quaternion rot; Vector3 scale; _curBody = GetBody(type, out pos, out rot, out scale); if (_curBody) { _curBody.transform.localPosition = Vector3.zero; _curBody.transform.localRotation = Quaternion.identity; _curBody.transform.localScale = Vector3.one; transform.localPosition = pos; transform.localRotation = rot; transform.localScale = scale; _curBody.gameObject.SetActive(true); _lastY = float.MinValue; } }
public void OpenMenu(Vector3 pos, BaibianType type, System.Action closeCallback) { foreach (var item in menus) { if (item.go) { if (item.type == type) { uiOptionRoot.SetActive(true); uiOptionPanel.anchoredPosition = pos; item.go.SetActive(true); _closeCallback = closeCallback; } else { item.go.SetActive(false); } } } }
public void Show(BaibianType baibianType, System.Action closeCallback) { _closeCallback = closeCallback; int value = (int)baibianType; gege.SetActive(value % 2 != 0); jiejie.SetActive(value % 2 == 0); gameObject.SetActive(true); if (typeStr.ContainsKey(baibianType)) { text.text = ""; text.fontSize = 36; var str = typeStr[baibianType]; _textTweener = text.DOText(str, str.Length * 5f / typeStr[BaibianType.tongnian].Length); _textTweener.SetEase(Ease.Linear); } else { text.text = ""; } }
protected override string GetBodyPath(BaibianType type) { return("baibian/world/jiejie/jiejie_" + type.ToString()); }
protected abstract string GetBodyPath(BaibianType type);