NativeArray <SceneTag> ExternalRefToSceneTag(NativeArray <ExternalEntityRefInfo> externalEntityRefInfos, Allocator allocator)
        {
            var sceneTags = new NativeArray <SceneTag>(externalEntityRefInfos.Length, allocator);

            using (var sectionDataEntities = m_SectionData.ToEntityArray(Allocator.TempJob))
            {
                using (var sectionData = m_SectionData.ToComponentDataArray <SceneSectionData>(Allocator.TempJob))
                {
                    for (int i = 0; i < sectionData.Length; ++i)
                    {
                        for (int j = 0; j < externalEntityRefInfos.Length; ++j)
                        {
                            if (
                                externalEntityRefInfos[j].SceneGUID == sectionData[i].SceneGUID
                                &&
                                externalEntityRefInfos[j].SubSectionIndex == sectionData[i].SubSectionIndex
                                )
                            {
                                sceneTags[j] = new SceneTag {
                                    SceneEntity = sectionDataEntities[i]
                                };
                                break;
                            }
                        }
                    }
                }
            }

            return(sceneTags);
        }
Example #2
0
    /// <summary>
    /// 根据标签跳转场景
    /// </summary>
    /// <param name="tag"></param>
    private static void ChangeScene(SceneTag tag)
    {
        m_tag = tag;
        HideSceneAction a = HideSceneAction.Create();

        if (a == null)
        {
            ChangeActionFinished();
        }
    }
 /// <summary>
 /// Muestra la escena deseada
 /// </summary>
 /// <param name="sceneTagGO"></param>
 public void ShowScene(SceneTagGO sceneTagGO)
 {
     foreach (Transform child in transform)
     {
         sceneSelector = child.GetComponent <SceneTag>();
         if (sceneSelector != null)
         {
             if (sceneSelector.SceneTagGO.Equals(sceneTagGO))
             {
                 child.gameObject.SetActive(true);
             }
             else
             {
                 child.gameObject.SetActive(false);
             }
         }
     }
     currentScene = sceneTagGO;
 }
Example #4
0
 private static void LoadSceneAsync(SceneTag tag)
 {
     LoadSceneAsync(Enum.GetName(typeof(SceneTag), tag));
 }
Example #5
0
 /// <summary>
 /// 根据标签跳转场景
 /// </summary>
 /// <param name="tag"></param>
 private static void ChangeScene(SceneTag tag)
 {
     LoadScene(SceneTag.Loading);
     m_tag = tag;
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     sceneTag     = GameObject.FindGameObjectWithTag("SceneTag").GetComponent <SceneTag> ();
     hollowBlocks = FindObjectsOfType <HollowBlock>();
 }
Example #7
0
    /// <summary>
    /// Unity Function. Called once in the game object's lifetime to initiate the script once it has been enabled
    /// </summary>
    void Start()
    {
        doesSceneExist = false;
        currentBlockID = 1;
        currentPieceID = 1;
        sceneTag       = GameObject.FindGameObjectWithTag("SceneTag").GetComponent <SceneTag> ();
        if (PlayerPrefs.HasKey("Username"))
        {
            folderDataPath = Application.persistentDataPath + "/Game Data/user_" + PlayerPrefs.GetString("Username");
//			Debug.LogError("Username "+PlayerPrefs.GetString("Username"));
        }
        else
        {
            folderDataPath = Application.persistentDataPath + "/Game Data/user_default";
        }

//		folderDataPath = Application.persistentDataPath + "/Game Data/user_1";
        Debug.Log("Folder data path: " + folderDataPath);
//		if (isNewUser) {
//			if (!Directory.Exists (folderDataPath)) {
//				currentFolderID = "1";
//			} else {
//				string[] directories = Directory.GetDirectories (folderDataPath);
//				List<int> folderIDs = new List<int> ();
//				foreach (string dir in directories) {
//					folderIDs.Add (int.Parse (dir.Split ('_').Last ()));
//				}
//
//				folderIDs.OrderByDescending (x => x);
//				string directoryName = directories.OrderByDescending (x => x).First ();
//				currentFolderID = (1 + folderIDs.OrderByDescending (x => x).First ()).ToString ();
//			}
//
//			folderDataPath = Application.persistentDataPath + "/Game Data/user_" + currentFolderID;
//			Debug.Log ("Folder data path: " + folderDataPath);
//			if (!Directory.Exists (folderDataPath)) {
//				Directory.CreateDirectory (folderDataPath);
//			}
//		} else {
//			folderDataPath += "/user_1";
//		}

        sceneData = new SceneData();
        yuniData  = new YuniData();
        userData  = new UserData();
        Debug.Log("Folder data path: " + folderDataPath);
        sceneDataPath  = folderDataPath + "/" + SceneManager.GetActiveScene().name + ".json";
        playerDataPath = folderDataPath + "/YuniData.json";
        userDataPath   = folderDataPath + "/UserData.json";
        playerHealth   = GameObject.FindObjectOfType <PlayerHealth> ();
        playerAttack   = GameObject.FindObjectOfType <PlayerAttack> ();
        hollowBlocks   = FindObjectsOfType <HollowBlock>();
        skyBlocks      = FindObjectsOfType <SkyBlock> ();
        foreach (HollowBlock block in hollowBlocks)
        {
            block.SetSceneObjectId(currentBlockID);
            currentBlockID++;
//			skyFragmentPieces = block.gameObject.GetComponentsInChildren<SkyFragmentPiece> ();
        }

        currentBlockID = 1;
        foreach (SkyBlock block in skyBlocks)
        {
            block.SetSceneObjectId(currentBlockID);
            currentBlockID++;
        }
    }
Example #8
0
 public void OnEnable()
 {
     scene = target as SceneTag;
 }