public static void ClearCache()
 {
     FarmSceneryCache.farmSceneryReference = null;
     if (null != FarmSceneryCache.cache)
     {
         UnityEngine.Object.Destroy(FarmSceneryCache.cache.gameObject);
         FarmSceneryCache.cache = null;
     }
 }
    public IEnumerator Initialize(FarmUI ui)
    {
        this.farmUI = ui;
        this.childDigimon.CreateDigimonGameObject();
        FarmScenery scenery = this.Scenery;

        yield return(base.StartCoroutine(scenery.InitializeFarmObjectParallelRead()));

        FarmSceneryCache.ClearCache();
        FarmSceneryCache.SetCacheAction(scenery);
        yield break;
    }
 public static void ExecutionCache()
 {
     if (null != FarmSceneryCache.farmSceneryReference)
     {
         GameObject gameObject = new GameObject("FarmSceneryCache");
         gameObject.transform.localScale    = Vector3.one;
         gameObject.transform.localPosition = Vector3.zero;
         gameObject.transform.localRotation = Quaternion.identity;
         gameObject.transform.parent        = null;
         gameObject.name = "FarmSceneryCache";
         UnityEngine.Object.DontDestroyOnLoad(gameObject);
         FarmRoot instance = FarmRoot.Instance;
         if (null != instance)
         {
             instance.ClearSettingFarmObject();
         }
         FarmSceneryCache.cache = gameObject.AddComponent <FarmSceneryCache>();
         FarmSceneryCache.cache.Execution(FarmSceneryCache.farmSceneryReference);
         FarmSceneryCache.farmSceneryReference = null;
     }
 }
    private FarmObject CreateFacilityObject(UserFacility userFacility)
    {
        FarmObject farmObject  = null;
        FarmObject farmObject2 = this.FindFarmObjectByFacilityId(userFacility.facilityId);

        if (null == farmObject2)
        {
            FarmSceneryCache cache = FarmSceneryCache.GetCache();
            if (null != cache)
            {
                FarmObject cacheFarmObject = cache.GetCacheFarmObject(userFacility.facilityId);
                if (null != cacheFarmObject)
                {
                    cacheFarmObject.transform.parent           = base.transform;
                    cacheFarmObject.transform.localScale       = Vector3.one;
                    cacheFarmObject.transform.localEulerAngles = Vector3.zero;
                    farmObject = cacheFarmObject;
                    farmObject.OnResumeFromCache();
                }
            }
            if (null == farmObject)
            {
                farmObject = this.LoadFarmObject(userFacility.facilityId);
            }
        }
        else
        {
            farmObject = this.DuplicateFarmObject(farmObject2);
        }
        if (null != farmObject)
        {
            farmObject.facilityID     = userFacility.facilityId;
            farmObject.userFacilityID = userFacility.userFacilityId;
        }
        return(farmObject);
    }
Beispiel #5
0
    public static void BackToTOP(string guiName = "UIStartupCaution", float outSec = 0.8f, float inSec = 0.8f)
    {
        ServerDateTime.isUpdateServerDateTime = false;
        GUIMain.self.StopAllCoroutines();
        if (null != ClassSingleton <FaceChatNotificationAccessor> .Instance.faceChatNotification)
        {
            ClassSingleton <FaceChatNotificationAccessor> .Instance.faceChatNotification.StopGetHistoryIdList();
        }
        ClassSingleton <GUIMonsterIconList> .Instance.PushBackAllMonsterPrefab();

        ClassSingleton <MonsterUserDataMng> .Instance.Initialize();

        ClassSingleton <GUIMonsterIconList> .Instance.AllDelete();

        GUIMain.DestroyAllDialog(null);
        GUIMain.onFadeBlackLoadScene = null;
        FarmSceneryCache.ClearCache();
        TutorialObserver tutorialObserver = UnityEngine.Object.FindObjectOfType <TutorialObserver>();

        if (null != tutorialObserver)
        {
            UnityEngine.Object.Destroy(tutorialObserver.gameObject);
        }
        TutorialUI tutorialUI = UnityEngine.Object.FindObjectOfType <TutorialUI>();

        if (null != tutorialUI)
        {
            if ("GUI" == tutorialUI.gameObject.name)
            {
                UnityEngine.Object.Destroy(tutorialUI);
                string[] array = new string[]
                {
                    "ROOT/Panel",
                    "ROOT/HitIcon",
                    "ROOT/HUD"
                };
                foreach (string name in array)
                {
                    GameObject gameObject = GameObject.Find(name);
                    if (null != gameObject)
                    {
                        UnityEngine.Object.Destroy(gameObject);
                    }
                }
            }
            else
            {
                UnityEngine.Object.Destroy(tutorialUI.gameObject);
            }
        }
        AppCoroutine appCoroutine = UnityEngine.Object.FindObjectOfType <AppCoroutine>();

        if (null != appCoroutine)
        {
            UnityEngine.Object.Destroy(appCoroutine.gameObject);
        }
        GUIMain.BarrierReset();
        Singleton <GUIManager> .Instance.UseOutsideTouchControl = false;
        FarmRoot instance = FarmRoot.Instance;

        if (null != instance)
        {
            InputControll input = instance.Input;
            if (null != input)
            {
                input.enabled = false;
            }
        }
        ClassSingleton <QuestData> .Instance.ClearWorldAreaMList();

        FarmCameraControlForCMD.ClearRefCT();
        GUICollider.DisableAllCollider("GUIMain");
        SoundMng.Instance().StopBGM(0.5f, delegate(int n)
        {
            if (GUIMain.gUIScreen != guiName)
            {
                Action <int> action = delegate(int x)
                {
                    GUIFadeControll.ActionRestart();
                };
                string guiName2      = guiName;
                Action <int> action_ = action;
                string aploadName_   = "Empty";
                string loadGUIName_  = guiName2;
                string empty         = string.Empty;
                if (GUIMain.< > f__mg$cache0 == null)
                {
                    GUIMain.< > f__mg$cache0 = new Action <int>(GUIMain.actCallBackBackToTOP);
                }
                GUIFadeControll.SetLoadInfo(action_, aploadName_, loadGUIName_, empty, GUIMain.< > f__mg$cache0, false);
                GUIFadeControll.SetFadeInfo(outSec, 0f, inSec, 1f);
                GUIManager.LoadCommonGUI("Effect/FADE_W", GUIMain.self.gameObject);
            }
        });
        GUIMain.nowBgm = string.Empty;
        Resources.UnloadUnusedAssets();
    }