コード例 #1
0
 /// <summary>
 /// Déclenche la fin d'un mini jeu
 /// </summary>
 /// <param name="isWin"> Définit si le joueur à gagner ou perdu le mini jeu</param>
 public void EndMiniGame(bool isWin)
 {
     if (!waitDelay)
     {
         minigameState = MiniGameState.paused;
         waitDelay     = true;
         if (isWin)
         {
             gameState = "WIN";
         }
         else
         {
             gameState = "LOSE";
             --life;
         }
         print("Life " + life);
         if (life <= 0)
         {
             SceneTools.ReplaceScene("GameOver");
         }
         else
         {
             ++level;
             StartCoroutine(NextSceneDelayed());
         }
     }
 }
コード例 #2
0
    private bool Init()
    {
        sceneConfigPath = Application.dataPath + "/" + sceneConfigPath;
        Scene curScene = SceneManager.GetActiveScene();

        if (curScene == null)
        {
            window.Close();
            window = null;
            UnityEditor.EditorUtility.DisplayDialog("Title", "请先打开场景", "是");
            return(false);
        }
        m_sceneName = curScene.name;

        LoadGroups();

        string configPath = SceneTools.getConfigPath();

        try
        {
            baseItemsData.Clear();
            System.Reflection.PropertyInfo[] proInfo;
            ConfHelper.LoadFromExcel <BaseItem>(configPath + "exhibit.xlsx", 0, out baseItemsData, out proInfo);
        }
        catch (IOException ex)
        {
            window.Close();
            window = null;
            UnityEditor.EditorUtility.DisplayDialog("Title", "先关表!!!", "是");
            return(false);
        }
        return(true);
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        contentList = new List <Content>();
        seenPOIs    = new List <POI>();
        //AddedPOIs = new List<POI>();
        Input.compass.enabled = true;
        //convert xml into class
        area = Area.Load("download");
        string Source = SceneTools.GetSettingValue("Source");

        if (Source == "")
        {
            Source = "realdata";
        }
        if (Source == "Test")
        {
            dataSetName = "UCL";
        }
        else
        {
            dataSetName = "RealData";
        }
        CreateTrackerPois();
        //StartCoroutine(LoadXML());
        // Vuforia 6.2+
        VuforiaARController.Instance.RegisterVuforiaStartedCallback(LoadDataSet);
        linkToVuforiaTarget();
    }
コード例 #4
0
    void Init()
    {
        string configPath = SceneTools.getConfigPath();

        System.Reflection.PropertyInfo[] proInfo;
        ConfHelper.LoadFromExcel <BaseItem>(configPath + "BaseItem.xlsx", 0, out baseItemsData, out proInfo);
        Scene scene = SceneManager.GetActiveScene();

        if (scene == null)
        {
            return;
        }
        sceneName = scene.name;
        dataDir   = Application.streamingAssetsPath + "/SceneData/" + sceneName + "/";
        string lightJsonStr = SceneTools.getJsonFile(dataDir + "lightData/" + sceneName + "_0_light.json");

        //object ooo = fastJSON.JSON.Parse(lightJsonStr);
        //objLightData = (SceneObjLightData)fastJSON.JSON.Parse(lightJsonStr);
        objLightData = fastJSON.JSON.ToObject <SceneObjLightData>(lightJsonStr);
        string itemJsonStr = SceneTools.getJsonFile(dataDir + sceneName + "_0.json");

        sceneItem = fastJSON.JSON.ToObject <SceneItemJson>(itemJsonStr);

        //sceneItem = (SceneItemJson)fastJSON.JSON.ToObject(itemJsonStr);
        for (int i = 0; i < sceneItem.items.Count; i++)
        {
            itemState.Add(false);
        }
        tex = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Res/Scene/" + sceneName + "/Lightmap-0_comp_light.exr");
    }
コード例 #5
0
ファイル: GameOverATH.cs プロジェクト: PawnProd/Shakedatasse
 public void Rejouer()
 {
     SceneTools.ReplaceScene("Menu");
     Destroy(GameController.Instance.gameObject);
     AudioController.Instance.ResetPitch();
     Destroy(AudioController.Instance.gameObject);
 }
コード例 #6
0
        private void LoadResSceneData()
        {
            string configPath = SceneTools.getConfigPath();

            System.Reflection.PropertyInfo[] sceneProInfo;
            ConfHelper.LoadFromExcel <SceneConfig>(configPath + "sceneResEditor.xlsx", 0, out sceneConfig, out sceneProInfo);
        }
コード例 #7
0
    void ButtonToChangeSetting()
    {
        if (isMneuOpen == true)
        {
            return;
        }
        GUIStyle titleStyle = new GUIStyle("button");

        titleStyle.fontSize = buttonFontSize;
        Rect r = new Rect(0, 5f / 8 * Screen.height, 0.2f * Screen.width, 0.1f * Screen.height);

        if (GUI.Button(r, "Change\n Setting", titleStyle))
        {
            //SceneTools.isTestMode = !SceneTools.isTestMode;
            if (SceneTools.CurrentSource == "realdata")
            {
                SceneTools.ChangeSetting("Test", "34", "false");
                SceneTools.CurrentSource = "Test";
            }

            else if (SceneTools.CurrentSource == "Test")
            {
                SceneTools.ChangeSetting("realdata", "34", "false");
                SceneTools.CurrentSource = "realdata";
            }
        }
    }
コード例 #8
0
    void ShowSetting()
    {
        String s = "";

        foreach (var a in SceneTools.getSetting())
        {
            s = s + a + "\n";
        }
        DrawText(new Vector2(Screen.width * 0.2f, 100), s);
    }
コード例 #9
0
ファイル: LoadMain.cs プロジェクト: nesschenes/Clouds
        /// <summary>Load scenes one by one</summary>
        public void LoadScenes(Scenes[] _scenes, LoadSceneMode _mode = LoadSceneMode.Additive, Action _onDone = null)
        {
            Action onLoadBegin = () =>
            {
                Action onLoadEnd = () => { OnDone(); _onDone?.Invoke(); };

                SceneTools.LoadScenesAsync(_scenes, _mode, OnProgress, onLoadEnd);
            };

            m_LoadUI.Show(onLoadBegin);
        }
コード例 #10
0
    System.Collections.IEnumerator wwwDownload(string Description)
    {
        WWW www = new WWW("file://" + Path.Combine(Application.persistentDataPath, SceneTools.AreaNameDefault() + "//" + Description));

        yield return(www);

        AudioClip clip = www.GetAudioClip();

        //clip = www.GetAudioClip(false,false,AudioType.MPEG);
        clip      = www.GetAudioClip(false, false, AudioType.MPEG);
        clip.name = Description;
        file.name = "url:" + Description;
        file.GetComponent <AudioSource>().clip = clip;
        Sound = file.GetComponent <AudioSource>();
        //file = ob;
    }
コード例 #11
0
    void ButtonToReadSetting()
    {
        if (isMneuOpen == true)
        {
            return;
        }
        GUIStyle titleStyle = new GUIStyle("button");

        titleStyle.fontSize = buttonFontSize;
        Rect r = new Rect(0, 6f / 8 * Screen.height, 0.2f * Screen.width, 0.1f * Screen.height);

        if (GUI.Button(r, "Log\n Setting", titleStyle))
        {
            SceneTools.printSetting();
            isShowSetting = !isShowSetting;
        }
    }
コード例 #12
0
    /// <summary>
    /// Load la scène suivante tout en actualisant la file
    /// </summary>
    public void NextScene()
    {
        string sceneName = sortPlayScene.Dequeue().ToString();

        print(sceneName);
        if (sceneName.Contains("Minigame"))
        {
            _allMiniGameScenes.Add(sceneName);
        }
        else if (sceneName.Contains("Bossgame"))
        {
            FillQueue();
        }
        speedRatio += 0.001f;
        gameRatio  += 0.01f;
        AudioController.Instance.ChangePitch(speedRatio);
        SceneTools.ReplaceScene(sceneName);
    }
コード例 #13
0
 /// <summary>
 /// Trie l'ensemble des scènes en fonction de leurs noms
 /// </summary>
 public void ParseScene()
 {
     string[] allScenes = SceneTools.GetAllScenes();
     foreach (string scene in allScenes)
     {
         if (scene.Contains("Minigame"))
         {
             _allMiniGameScenes.Add(scene);
         }
         else if (scene.Contains("Bossgame"))
         {
             _bossScene = scene;
         }
         else if (!scene.Contains("Menu") && !scene.Contains("GameOver"))
         {
             _transitionScene = scene;
         }
     }
 }
コード例 #14
0
ファイル: UtilityMenus.cs プロジェクト: xJayLee/Elarion
        private static void ToggleUIComponentHelpers()
        {
            var hideHelpers = !EditorPrefs.GetBool(Consts.HideUIComponentHelpersKey);

            EditorPrefs.SetBool(Consts.HideUIComponentHelpersKey, hideHelpers);

            var components = SceneTools.FindSceneObjectsOfType <UIComponent>();

            foreach (var component in components)
            {
                if (hideHelpers)
                {
                    Utils.HideBuiltinHelpers(component);
                }
                else
                {
                    Utils.ShowBuiltinHelpers(component);
                }
            }
        }
コード例 #15
0
    void showNearestPOI()
    {
        GPSlocation userPosition = new GPSlocation(51.5221, -0.131411);

        if (UnityEngine.Input.location.status == LocationServiceStatus.Running)
        {
            double longitude = Input.location.lastData.longitude;
            double latitude  = Input.location.lastData.latitude;
            userPosition = new GPSlocation(latitude, longitude);
        }
        if (area.POIs != null)
        {
            POI    nearestPoi = area.GetNearestPOI(userPosition); // area.POIs[0];
            string name       = nearestPoi.Name;
            if (name.Contains("."))
            {
                name = name.Split('.')[1];
            }
            string s = "The nearest POI is " + name + "\n " + (int)(nearestPoi.GetDistance(userPosition)) + "m away.";
            DrawText(new Vector2(Screen.width * 0.2f, Screen.height * 0.6f), s);
            string p = Path.Combine(Application.persistentDataPath, SceneTools.AreaNameDefault() + "/" + "StreamingAssets" + "/" + nearestPoi.ImageTarget);
            if (NearestPOIpath != p)
            {
                Debug.Log("different");
                if (System.IO.File.Exists(p))
                {
                    Texture2D texture = new Texture2D(512, 512);
                    texture.LoadImage(System.IO.File.ReadAllBytes(p));
                    NearestPOITexture = texture;
                    NearestPOIpath    = p;
                    //GameObject plane = GameObject.Find("NearPOI");
                    //plane.GetComponent<Renderer>().material.mainTexture = NearestPOITexture;
                }
                else
                {
                    Debug.LogWarning("Texture " + p + " does not exist");
                }
            }
            GUI.DrawTexture(new Rect((float)0.1 * Screen.width, (float)0.1 * Screen.width, (float)0.8 * Screen.width, (float)0.8 * Screen.width), NearestPOITexture, ScaleMode.ScaleToFit, true, 0);
        }
    }
コード例 #16
0
    void SetImageContent(Content example)
    {
        string p = Path.Combine(Application.persistentDataPath, SceneTools.AreaNameDefault() + "/" + example.Description);

        if (LastPath == p)
        {
            return;
        }
        if (System.IO.File.Exists(p))
        {
            Texture2D texture = new Texture2D(512, 512);
            texture.LoadImage(System.IO.File.ReadAllBytes(p));
            aTexture = texture;
            LastPath = p;
            //GameObject.Find("RawImage").transform.GetComponent<RawImage>().texture  = texture;
        }
        else
        {
            Debug.LogWarning("Texture " + p + " does not exist");
        }
    }
コード例 #17
0
        public static void SetGroupToAutoOpen(UIComponentGroup group)
        {
            if (!group)
            {
                return;
            }

            group.Component.OpenType = UIOpenType.Auto;

            var allGroups = SceneTools.FindSceneObjectsOfType <UIComponentGroup>();

            foreach (var otherGroup in allGroups)
            {
                if (otherGroup != group &&
                    otherGroup.GroupId == group.GroupId &&
                    otherGroup.Component.OpenType == UIOpenType.Auto)
                {
                    otherGroup.Component.OpenType = UIOpenType.Manual;
                }
            }
        }
コード例 #18
0
ファイル: Initialize.cs プロジェクト: nesschenes/Clouds
        protected override void Awake()
        {
            base.Awake();

            SceneTools.LoadSceneAsync(Scenes.LoadUI);
        }
コード例 #19
0
    bool Init()
    {
        //load base item for table
        Scene scene = SceneManager.GetActiveScene();

        if (scene != null)
        {
            sceneName = scene.name;
            pathDir   = "Assets" + pathDir + scene.name + "/"; //+ ".asset";
        }

        if (string.IsNullOrEmpty(sceneName) || sceneName.Equals("EmptyScene") || sceneName.Equals("main_ui"))
        {
            UnityEditor.EditorUtility.DisplayDialog("Title", "当前场景为空!!!", "是");
            return(false);
        }

        m_allItemInfo = JsonToSceneData.RevertAsset();

        lightTempPath += sceneName;
        scenePath     += sceneName;

        jsonPath = Application.dataPath + jsonPath + sceneName + "/";
        string configPath = SceneTools.getConfigPath();

        try {
            System.Reflection.PropertyInfo[] proInfo;
            ConfHelper.LoadFromExcel <BaseItem>(configPath + "exhibit.xlsx", 0, out baseItemsData, out proInfo);

            List <SceneConfig> sceneConfig;
            System.Reflection.PropertyInfo[] sceneProInfo;
            ConfHelper.LoadFromExcel <SceneConfig>(configPath + "sceneResEditor.xlsx", 0, out sceneConfig, out sceneProInfo);
            sceneID = getSceneID(sceneConfig);
            //if (!Directory.Exists(pathDir))
            //{
            //    Directory.CreateDirectory(pathDir);
            //    //创建asset
            //    itemInfos = ScriptableObject.CreateInstance<SceneItemInfo>();
            //    itemInfos.items = new List<ItemInfo>();
            //    AssetDatabase.CreateAsset(itemInfos, pathDir + sceneName + "_0.asset");
            //    AssetDatabase.Refresh();
            //}
            //string[] allAssetPath = Directory.GetFiles(pathDir, "*.asset");
            for (int i = 0; i < m_allItemInfo.Count; i++)
            {
                m_allAssetName.Add(m_allItemInfo[i].jsonName);
            }
            LoadAssetData();

            GameObject[] cameraPoint = GameObject.FindGameObjectsWithTag("cameraPoint");
            m_allCameraNode.Add("MainCamera");
            for (int i = 0; i < cameraPoint.Length; i++)
            {
                m_allCameraNode.Add(cameraPoint[i].name);
            }
            UserLog.OpenSceneLog();
        }
        catch (IOException ex)
        {
            window.Close();
            window = null;
            UnityEditor.EditorUtility.DisplayDialog("Title", "先关表!!!", "是");
            return(false);
        }
        return(true);
    }
コード例 #20
0
ファイル: Area.cs プロジェクト: uclhenry/FinalYearProject
    public void LinkTo(GameObject contentContainer)
    {
        GameObject content;

        Debug.LogWarning("contentContainer instantiate ");
        switch (Type)
        {
        case PoiDataType.texture2D:


            content = (GameObject)GameObject.CreatePrimitive(PrimitiveType.Plane);
            content.transform.parent = contentContainer.transform;
            content.name             = content.transform.parent.name + "_tex2D";

            content.transform.position = Position.getVector3();
            content.transform.rotation = /*Rotation.getQuaternion() +*/ Quaternion.Euler(0f, 180f, 0f);
            //content.transform.localScale= Scale.getVector3();
            content.transform.localScale        = new Vector3(100, 100, 100);
            content.transform.parent.localScale = new Vector3(0.001f, 0.001f, 0.001f);
            string p = Path.Combine(Application.persistentDataPath, SceneTools.AreaNameDefault() + "/" + Description);
            Debug.Log(p);

            content.AddComponent <DragScript>();
            if (System.IO.File.Exists(p))
            {
                Texture2D texture = new Texture2D(512, 512);
                texture.LoadImage(System.IO.File.ReadAllBytes(p));
                content.GetComponent <MeshCollider>().enabled          = true;
                content.GetComponent <Renderer>().material.mainTexture = texture;
            }
            else
            {
                Debug.LogWarning("Texture " + p + " does not exist");
            }

            Debug.Log("A picture from" + content.name);
            break;

        case PoiDataType.object3D:
            content = new GameObject();
            content.transform.parent = contentContainer.transform;
            content.name             = content.transform.parent.name + "_obj3D";
            //content.layer                 = LayerMask.NameToLayer(SceneTools.ContentLayerMaskName());

            //Model3D model3D           = GameObject.Find("Object3DManager").GetComponent<Model3D>();
            //GameObject[] models       = model3D.Load(Path.Combine(Application.persistentDataPath, SceneTools.AreaNameDefault() + "/"+Description));
            Debug.Log("A object3D from" + content.name);
            break;

        case PoiDataType.audio:

            if (Description.Contains("mp3"))
            {
                //Debug.Log("A audio called" + Description);
                GameObject prefeb_Container = (GameObject)Resources.Load("AudioContainer", typeof(GameObject));
                content = GameObject.Instantiate <GameObject>(prefeb_Container, new Vector3(0, 0, 0), Quaternion.identity);
                content.transform.parent = contentContainer.transform;
                content.name             = content.transform.parent.name + "_audio";
                //content.layer                 = LayerMask.NameToLayer(SceneTools.ContentLayerMaskName());
                Test t = (content.GetComponent("Test") as Test);
                t.sendAudioName(Description, content);
                content.transform.position = Position.getVector3();
                Debug.Log("A audio from" + content.name);
                content.AddComponent <MeshCollider>();
                content.AddComponent <DragScript>();
                mediaGo = content;
            }
            break;

        case PoiDataType.text:

            GameObject TextContent = GameObject.Find("TextContent");
            content = (GameObject)GameObject.Instantiate(TextContent);
            //augmentation.transform.parent = tb.gameObject.transform;
            content.transform.SetParent(contentContainer.transform);
            content.transform.localPosition = new Vector3(0f, 1f, 0f);
            Quaternion target = Quaternion.Euler(90f, 0, 0);
            content.transform.localRotation = target;    // Quaternion.identity;
            content.name = content.transform.parent.name + "_text";
            content.GetComponentInChildren <Text>().text = Description;
            content.GetComponent <Canvas>().enabled      = true;
            content.transform.localScale = new Vector3(10f, 10f, 10f);
            content.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(500, 900);
            GameObject textGo = content.transform.GetChild(0).gameObject;

            textGo.AddComponent <MeshCollider>();
            textGo.AddComponent <DragScript>();
            break;

        default:
            Debug.LogWarning("POI type not implemented");
            break;
        }
    }
コード例 #21
0
ファイル: Area.cs プロジェクト: uclhenry/FinalYearProject
    public static Area Load(string mod)    //Area
    {
        string LastTime    = "";
        string LastTimeNew = "";
        string Source      = SceneTools.GetSettingValue("Source");

        if (Source == "")
        {
            Source = "realdata";
            SceneTools.ChangeSetting("realdata", "34", "false");
        }
        SceneTools.CurrentSource = SceneTools.GetSettingValue("Source");
        Debug.Log(Source);
        bool isExistDateFile = File.Exists(SceneTools.AreaZipLastTimeLocal());

        if (mod.Equals("download"))//update or download
        {
            if (Source == "realdata")
            {
                Debug.LogWarning("Downloading readdata");
                if (!File.Exists(SceneTools.AreaZipFileLocal()))//not exist zip
                {
                    SceneTools.ClearLocalData();
                    SceneTools.DownloadFileFromUrlSync(SceneTools.AreaZipLastTimeUrl(), SceneTools.AreaZipLastTimeLocal());
                    SceneTools.DownloadFileFromUrlSync(SceneTools.AreaZipFileUrl(), SceneTools.AreaZipFileLocal());
                    new ZipIt(SceneTools.AreaZipFileLocal(), "", Application.persistentDataPath);
                }
                //}
                else //the have zip,then check the update
                {
                    if (isExistDateFile)
                    {
                        LastTime = File.ReadAllText(SceneTools.AreaZipLastTimeLocal());

                        SceneTools.DownloadFileFromUrlSync(SceneTools.AreaZipLastTimeUrl(), SceneTools.AreaZipLastTimeLocal());

                        LastTimeNew = File.ReadAllText(SceneTools.AreaZipLastTimeLocal());

                        if (Convert.ToInt64(LastTimeNew) > Convert.ToInt64(LastTime))
                        {
                            //update
                            Debug.Log("Downloading new zip file");
                            SceneTools.DownloadFileFromUrlSync(SceneTools.AreaZipFileUrl(), SceneTools.AreaZipFileLocal());
                            new ZipIt(SceneTools.AreaZipFileLocal(), "", Application.persistentDataPath);
                        }
                        else
                        {
                            //not gonna update
                            Debug.Log("Zip file is latest version");
                        }
                    }
                    else //unknown version ,so update   ,or last version is test
                    {
                        SceneTools.ClearLocalData();
                        Debug.Log("Zip not File.Exists (SceneTools.AreaZipLastTimeLocal())");
                        SceneTools.DownloadFileFromUrlSync(SceneTools.AreaZipLastTimeUrl(), SceneTools.AreaZipLastTimeLocal());
                        SceneTools.DownloadFileFromUrlSync(SceneTools.AreaZipFileUrl(), SceneTools.AreaZipFileLocal());//AreaZipFileUrl()
                        new ZipIt(SceneTools.AreaZipFileLocal(), "", Application.persistentDataPath);
                    }
                }
            }
            else if (Source == "Test")
            {
                if (isExistDateFile)
                {                                //realdata
                    SceneTools.ClearLocalData(); //delete realdata
                    SceneTools.DownloadFileFromUrlSync(SceneTools.testZip, SceneTools.AreaZipFileLocal());
                    new ZipIt(SceneTools.AreaZipFileLocal(), "", Application.persistentDataPath);
                }
                else if (!File.Exists(SceneTools.AreaZipFileLocal()))
                {
                    SceneTools.ClearLocalData();//delete realdata
                    SceneTools.DownloadFileFromUrlSync(SceneTools.testZip, SceneTools.AreaZipFileLocal());
                    new ZipIt(SceneTools.AreaZipFileLocal(), "", Application.persistentDataPath);
                }
            }
            //{
        }
        SceneTools.ChangeSetting(SceneTools.CurrentSource, "34", "false");
        //convert the xml into a cs object (after downloading all the file or file is already)
        var serializer = new XmlSerializer(typeof(Area));

        using (var stream = new FileStream(Path.Combine(Application.persistentDataPath + "/" + SceneTools.AreaNameDefault(), SceneTools.AreaNameDefault() + ".xml"), FileMode.Open))
        {
            return(serializer.Deserialize(stream) as Area);
        }
    }
コード例 #22
0
 private void Awake()
 {
     instance = this;
 }
コード例 #23
0
ファイル: LoadMain.cs プロジェクト: nesschenes/Clouds
 public void UnLoadScene(Scenes _scene)
 {
     SceneTools.UnLoadSceneAsync(_scene);
 }
コード例 #24
0
 private void OnEnable()
 {
     _componentGroups = SceneTools.FindSceneObjectsOfType <UIComponentGroup>();
     _otherMembers    = _componentGroups.Count(g => g.GroupId == Target.GroupId);
 }
コード例 #25
0
ファイル: LoadMain.cs プロジェクト: nesschenes/Clouds
 public void UnLoadScenes(Scenes[] _scene)
 {
     SceneTools.UnLoadScenesAsync(_scene);
 }
コード例 #26
0
    public bool Init()
    {
        string sceneConfigPath = Application.dataPath + "/" + LightingData.constConfigPath;
        string scenePath       = Application.dataPath + "/Res/Scene/";
        Scene  curScene        = SceneManager.GetActiveScene();

        if (curScene == null)
        {
            window.Close();
            window = null;
            UnityEditor.EditorUtility.DisplayDialog("Title", "请先打开场景", "是");
            return(false);
        }
        m_sceneName   = curScene.name;
        lightSystem   = new LightSystem(new LightingData(curScene.name, sceneConfigPath, SceneTools.getConfigPath(), scenePath));
        recoverSystem = new LightRecoverSystem(new LightingData(curScene.name, sceneConfigPath, SceneTools.getConfigPath(), scenePath));
        lightSystem.OnInit();
        Lightmapping.completed = lightSystem.BakeOver;
        return(true);
    }