Пример #1
0
 void OnDestroy()
 {
     Instance = null;
     System.GC.Collect();
     Resources.UnloadUnusedAssets();
 }
Пример #2
0
        void Awake()
        {
            Instance = this;
            GameObject _canonCache = GameObject.Find("CanonCache");

            if (_canonCache == null)
            {
                _canonCache                                = new GameObject();
                _canonCache.name                           = "CanonCache";
                _canonCache.transform.parent               = GameObject.Find("Camera").transform;
                _canonCache.transform.localScale           = Vector3.one;
                _canonCache.AddComponent <UIAnchor>().side = UIAnchor.Side.BottomLeft;
            }
            canonCache = _canonCache.transform;

            // 创建 10 个足够多.
            dirArray                = new int[10];
            singleCanonList         = new SingleCanon[10];
            canonScaleFitResolRatio = new Vector3[10];

            // 以下获取背包系统.
            if (backage == null)
            {
                backage = GameObject.Find("backage").transform;
            }
#if !UNITY_STANDALONE_WIN
            if (lockButton == null)
            {
                //lockButton = backage.FindChild("lockButton");
                lockButton = m_pPhone_Left_Button.lockButton;
            }
            if (speedUpButton == null)
            {
                //speedUpButton = backage.FindChild("speedUpButton");
                speedUpButton = m_pPhone_Left_Button.speedUpButton;
            }
            if (autoFireButton == null)
            {
                //autoFireButton = backage.FindChild("autoFireButton");
                autoFireButton = m_pPhone_Left_Button.autoFireButton;
            }
#endif
            if (accountPanel == null)
            {
                accountPanel = backage.FindChild("accountPanel");
            }
            if (plyNameLabel == null)
            {
                plyNameLabel = backage.FindChild("plyNameLabel").GetComponent <UILabel>();
            }
            if (goldValueLabel == null)
            {
                //goldValueLabel = backage.FindChild("gold").GetChild(0).GetComponent<UILabel>();
                goldValueLabel = backage.FindChild("gold").gameObject;
            }

            // 结算 account 的大小为 0(当前不用这个结算界面)..
//			accountPanel.localScale = Vector3.zero;

            // 重置 account 里杀死鱼的数量
            ClearAccountKillFishNum();

            // 重置 account 里的 金币数 和 豆豆数量
            SetTempGoldAndBeansValue(0, 0);
        }