コード例 #1
0
    void Awake()
    {
        sceneSetting = GameObject.Find("SceneSetting").GetComponent <SceneSetting> ();

        // indicatorImage = Resources.Load ("image/node.png") as Sprite;
        // indicatorSelectImage = Resources.Load ("image/node_select.png") as Sprite;
    }
コード例 #2
0
        public async Task RegisterAsyncNewTest()
        {
            //arrange
            var dbConnection = new UnitTestDbConnection();

            Database.SetInitializer(new CreateFreshDbInitializer());
            var ssb = new SceneSettingBuilder(dbConnection);

            var sceneSetting = new SceneSetting
            {
                Name             = "Unit Test Scene Setting",
                UniqueIdentifier = "SCENE_SETTING1"
            };

            //act
            var result = await ssb.RegisterAsync(sceneSetting, CancellationToken.None);

            SceneSetting setting;

            using (var context = new ZvsContext(dbConnection))
            {
                setting =
                    await
                    context.SceneSettings.FirstOrDefaultAsync(
                        o => o.UniqueIdentifier == sceneSetting.UniqueIdentifier);
            }

            //assert
            Console.WriteLine(result.Message);
            Assert.IsFalse(result.HasError, result.Message);
            Assert.IsNotNull(setting, "Expected new scene setting saved to DB");
        }
コード例 #3
0
ファイル: RoundManager.cs プロジェクト: liangmbs/VistaLight
    void Awake()
    {
        logger       = GameObject.Find("BasicLoggerManager").GetComponent <VistaLightsLogger>();
        sceneSetting = GameObject.Find("SceneSetting").GetComponent <SceneSetting> ();

        logger.StartRun("run");
    }
コード例 #4
0
    /// <summary>
    /// ゲームオーバーになった時の処理
    /// </summary>
    void OnGameOver()
    {
        // シーンの設定のキャッシュ
        sceneSetting = sceneSetting ?? GameObject.FindGameObjectWithTag(TagName.SceneSettings).GetComponent <SceneSetting>();
        // 今のステージ数
        var nowStageNum = sceneSetting.StageNumber;

        // 今のステージがまだクリアできていないステージだったら
        if (nowStageNum == SaveDataManager.Inst.GetClearStageNum() + 1)
        {
            levelGameOverCount++;
        }
        // 今のステージがすでにクリアしているステージだったら
        else
        {
            gameObject.SetActive(false);
        }
        // ゲームオーバーになった回数がスキップボタンを表示するまでの回数以上だったら
        if (levelGameOverCount >= showSkipButtonNum)
        {
            gameObject.SetActive(true);
        }
        // そうじゃない時
        else
        {
            gameObject.SetActive(false);
        }
    }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: kidsang/ProjectJ
 private void CmdNewFile(object sender, ExecutedRoutedEventArgs e)
 {
     SceneSetting data = new SceneSetting(true);
     data.Map.CellCountX = 10;
     data.Map.CellCountY = 10;
     DoLoadFile(data);
 }
コード例 #6
0
ファイル: SceneDataProxy.cs プロジェクト: kidsang/ProjectJ
 public void Load(SceneSetting data, string path = null)
 {
     DataPath = path;
     InfoMap infos = new InfoMap();
     infos["path"] = path;
     repo.New(data, EditorEvent.MAP_LOAD, infos);
     UpdateRemoteData();
 }
コード例 #7
0
ファイル: SceneSetting.cs プロジェクト: liangmbs/VistaLight
 void DestoryIfInstanceExist()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
 }
コード例 #8
0
        public async Task <Result> RegisterAsync(SceneSetting sceneSetting, CancellationToken cancellationToken)
        {
            if (sceneSetting == null)
            {
                return(Result.ReportError("sceneSetting is null"));
            }

            using (var context = new ZvsContext(EntityContextConnection))
            {
                var existingSetting = await context.SceneSettings
                                      .Include(o => o.Options)
                                      .FirstOrDefaultAsync(s => s.UniqueIdentifier == sceneSetting.UniqueIdentifier, cancellationToken);

                var changed = false;
                if (existingSetting == null)
                {
                    context.SceneSettings.Add(sceneSetting);
                    changed = true;
                }
                else
                {
                    //Update
                    PropertyChangedEventHandler handler = (s, a) => changed = true;
                    existingSetting.PropertyChanged += handler;

                    existingSetting.Name        = sceneSetting.Name;
                    existingSetting.Description = sceneSetting.Description;
                    existingSetting.ValueType   = sceneSetting.ValueType;
                    existingSetting.Value       = sceneSetting.Value;

                    existingSetting.PropertyChanged -= handler;

                    var added = sceneSetting.Options.Where(option => existingSetting.Options.All(o => o.Name != option.Name)).ToList();
                    foreach (var option in added)
                    {
                        existingSetting.Options.Add(option);
                        changed = true;
                    }

                    var removed = existingSetting.Options.Where(option => sceneSetting.Options.All(o => o.Name != option.Name)).ToList();
                    foreach (var option in removed)
                    {
                        context.SceneSettingOptions.Local.Remove(option);
                        changed = true;
                    }
                }

                if (changed)
                {
                    return(await context.TrySaveChangesAsync(cancellationToken));
                }

                return(Result.ReportSuccess("Nothing to update"));
            }
        }
コード例 #9
0
    /// <summary>
    /// ゲームクリアになった時の処理
    /// </summary>
    void OnGameClear()
    {
        sceneSetting = sceneSetting ?? GameObject.FindGameObjectWithTag(TagName.SceneSettings).GetComponent <SceneSetting>();
        var nowStageNum = sceneSetting.StageNumber;

        // まだクリアしていないステージを初めてクリアしたらリセット
        if (nowStageNum == SaveDataManager.Inst.GetClearStageNum())
        {
            levelGameOverCount = 0;
        }
    }
コード例 #10
0
ファイル: DockVO.cs プロジェクト: liangmbs/VistaLight
    public void OnMouseDrag()
    {
        SceneSetting sceneSetting = GameObject.Find("SceneSetting").GetComponent <SceneSetting>();

        if (sceneSetting.AllowMapEditing)
        {
            RaycastHit2D ray = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
            dock.node.X = ray.point.x;
            dock.node.Y = ray.point.y;
        }
    }
コード例 #11
0
    // Use this for initialization
    void Start()
    {
        SceneSetting sceneSetting = GameObject.Find("SceneSetting").GetComponent <SceneSetting> ();

        if (!sceneSetting.GiveRecommendation)
        {
            RecommendationTab.SetActive(false);
        }

        showJustifiction = sceneSetting.RecommendWithJustification;
    }
コード例 #12
0
        public async Task RegisterAsyncOptionRemoveTest()
        {
            //arrange
            var dbConnection = new UnitTestDbConnection();

            Database.SetInitializer(new CreateFreshDbInitializer());
            var ssb = new SceneSettingBuilder(dbConnection);

            var sceneSetting = new SceneSetting
            {
                Name             = "Unit Test Scene Setting",
                UniqueIdentifier = "SCENE_SETTING1",
            };

            var option1 = new SceneSettingOption
            {
                Name = "Option 1"
            };
            var option2 = new SceneSettingOption
            {
                Name = "Option 2"
            };

            sceneSetting.Options.Add(option1);
            sceneSetting.Options.Add(option2);

            using (var context = new ZvsContext(dbConnection))
            {
                context.SceneSettings.Add(sceneSetting);
                await context.SaveChangesAsync();
            }

            sceneSetting.Options.Remove(option2);

            //act
            var result = await ssb.RegisterAsync(sceneSetting, CancellationToken.None);

            SceneSetting setting;

            using (var context = new ZvsContext(dbConnection))
            {
                setting = await context.SceneSettings
                          .Include(o => o.Options)
                          .FirstOrDefaultAsync(o => o.UniqueIdentifier == sceneSetting.UniqueIdentifier);
            }

            //assert
            Console.WriteLine(result.Message);
            Assert.IsFalse(result.HasError, result.Message);
            Assert.IsNotNull(setting, "Expected new scene setting saved to DB");
            Assert.IsTrue(setting.Options.Count == 1, "Expected 1 option!");
            Assert.IsTrue(setting.Options[0].Name == option1.Name);
        }
コード例 #13
0
    public void StartRun(string challengeName)
    {
        JSONClass details = new JSONClass();

        AddTimeInformation(details);
        SceneSetting sceneSetting = GameObject.Find("SceneSetting").GetComponent <SceneSetting> ();

        details ["map"] = sceneSetting.MapName;
        details ["give_recommendation"] = sceneSetting.GiveRecommendation.ToString();
        details ["with_justification"]  = sceneSetting.RecommendWithJustification.ToString();
        TheLogger.instance.BeginRun(challengeName, details);
        inRun = true;
    }
コード例 #14
0
ファイル: NodeVO.cs プロジェクト: liangmbs/VistaLight
    public void OnMouseDrag()
    {
        SceneSetting sceneSetting = GameObject.Find("SceneSetting").GetComponent <SceneSetting>();

        if (sceneSetting.AllowMapEditing)
        {
            RaycastHit2D ray = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
            if (ray.point.x == 0 && ray.point.y == 0)
            {
                return;
            }
            node.X = ray.point.x;
            node.Y = ray.point.y;
            gameObject.transform.position = new Vector3((float)node.X, (float)node.Y, (float)MapController.MapZIndex);
        }
    }
コード例 #15
0
    public void RequestRecommendation()
    {
        recommendationRequested = true;

        bool         giveRecommendation = false;
        SceneSetting sceneSetting       = GameObject.Find("SceneSetting").GetComponent <SceneSetting> ();

        giveRecommendation = sceneSetting.GiveRecommendation;

        if (giveRecommendation)
        {
            Recommend();
        }

        ShowRecommendations();
    }
コード例 #16
0
ファイル: MainWindow.xaml.cs プロジェクト: kidsang/ProjectJ
 private void DoLoadFile(SceneSetting data, string path = null)
 {
     SceneDataProxy.Instance.Load(data, path);
 }
コード例 #17
0
ファイル: ActionNavMesh.cs プロジェクト: mcbodge/eidolon
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            if (KickStarter.sceneSettings == null)
            {
                return;
            }

            sceneSetting = (SceneSetting) EditorGUILayout.EnumPopup ("Scene setting to change:", sceneSetting);

            if (sceneSetting == SceneSetting.DefaultNavMesh)
            {
                if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider)
                {
                    if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider)
                    {
                        changeNavMeshMethod = (ChangeNavMeshMethod) EditorGUILayout.EnumPopup ("Change NavMesh method:", changeNavMeshMethod);
                    }

                    if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || changeNavMeshMethod == ChangeNavMeshMethod.ChangeNavMesh)
                    {
                        parameterID = Action.ChooseParameterGUI ("New NavMesh:", parameters, parameterID, ParameterType.GameObject);
                        if (parameterID >= 0)
                        {
                            constantID = 0;
                            newNavMesh = null;
                        }
                        else
                        {
                            newNavMesh = (NavigationMesh) EditorGUILayout.ObjectField ("New NavMesh:", newNavMesh, typeof (NavigationMesh), true);

                            constantID = FieldToID <NavigationMesh> (newNavMesh, constantID);
                            newNavMesh = IDToField <NavigationMesh> (newNavMesh, constantID, false);
                        }
                    }
                    else if (changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles)
                    {
                        holeAction = (InvAction) EditorGUILayout.EnumPopup ("Add or remove hole:", holeAction);
                        string _label = "Hole to add:";
                        if (holeAction == InvAction.Remove)
                        {
                            _label = "Hole to remove:";
                        }

                        parameterID = Action.ChooseParameterGUI (_label, parameters, parameterID, ParameterType.GameObject);
                        if (parameterID >= 0)
                        {
                            constantID = 0;
                            hole = null;
                        }
                        else
                        {
                            hole = (PolygonCollider2D) EditorGUILayout.ObjectField (_label, hole, typeof (PolygonCollider2D), true);

                            constantID = FieldToID <PolygonCollider2D> (hole, constantID);
                            hole = IDToField <PolygonCollider2D> (hole, constantID, false);
                        }

                        if (holeAction == InvAction.Replace)
                        {
                            replaceParameterID = Action.ChooseParameterGUI ("Hole to remove:", parameters, replaceParameterID, ParameterType.GameObject);
                            if (replaceParameterID >= 0)
                            {
                                replaceConstantID = 0;
                                replaceHole = null;
                            }
                            else
                            {
                                replaceHole = (PolygonCollider2D) EditorGUILayout.ObjectField ("Hole to remove:", replaceHole, typeof (PolygonCollider2D), true);

                                replaceConstantID = FieldToID <PolygonCollider2D> (replaceHole, replaceConstantID);
                                replaceHole = IDToField <PolygonCollider2D> (replaceHole, replaceConstantID, false);
                            }
                        }
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox ("This action is not compatible with the Unity Navigation pathfinding method, as set in the Scene Manager.", MessageType.Warning);
                }
            }
            else if (sceneSetting == SceneSetting.DefaultPlayerStart)
            {
                parameterID = Action.ChooseParameterGUI ("New default PlayerStart:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    playerStart = null;
                }
                else
                {
                    playerStart = (PlayerStart) EditorGUILayout.ObjectField ("New default PlayerStart:", playerStart, typeof (PlayerStart), true);

                    constantID = FieldToID <PlayerStart> (playerStart, constantID);
                    playerStart = IDToField <PlayerStart> (playerStart, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.SortingMap)
            {
                parameterID = Action.ChooseParameterGUI ("New SortingMap:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    sortingMap = null;
                }
                else
                {
                    sortingMap = (SortingMap) EditorGUILayout.ObjectField ("New SortingMap:", sortingMap, typeof (SortingMap), true);

                    constantID = FieldToID <SortingMap> (sortingMap, constantID);
                    sortingMap = IDToField <SortingMap> (sortingMap, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.TintMap)
            {
                parameterID = Action.ChooseParameterGUI ("New TintMap:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    tintMap = null;
                }
                else
                {
                    tintMap = (TintMap) EditorGUILayout.ObjectField ("New TintMap:", tintMap, typeof (TintMap), true);

                    constantID = FieldToID <TintMap> (tintMap, constantID);
                    tintMap = IDToField <TintMap> (tintMap, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.OnLoadCutscene)
            {
                parameterID = Action.ChooseParameterGUI ("New OnLoad cutscene:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    cutscene = null;
                }
                else
                {
                    cutscene = (Cutscene) EditorGUILayout.ObjectField ("New OnLoad custscne:", cutscene, typeof (Cutscene), true);

                    constantID = FieldToID <Cutscene> (cutscene, constantID);
                    cutscene = IDToField <Cutscene> (cutscene, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.OnStartCutscene)
            {
                parameterID = Action.ChooseParameterGUI ("New OnStart cutscene:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    cutscene = null;
                }
                else
                {
                    cutscene = (Cutscene) EditorGUILayout.ObjectField ("New OnStart cutscene:", cutscene, typeof (Cutscene), true);

                    constantID = FieldToID <Cutscene> (cutscene, constantID);
                    cutscene = IDToField <Cutscene> (cutscene, constantID, false);
                }
            }

            AfterRunningOption ();
        }
コード例 #18
0
ファイル: GameEditor.cs プロジェクト: kidsang/ProjectJ
 public void NewMap(int cellCountX, int cellCountY)
 {
     SceneSetting data = new SceneSetting(true);
     data.Map.CellCountX = cellCountX;
     data.Map.CellCountY = cellCountY;
     LoadMap(data);
 }
コード例 #19
0
//        //读取地图地图设定 参数:地图包

//        public void ReadSceneSetting(ScenePack scenePack)
//        {
//            Resources.UnloadUnusedAssets();


//            try
//            {
//#if DEBUG
//                GeoTools.Log(Application.dataPath);
//#endif
//                if (!File.Exists(scenePack.SettingFilePath))
//                {
//                    GeoTools.Log("Error! Scene File not exists!");
//                    return;
//                }

//                FileStream fs = new FileStream(scenePack.SettingFilePath, FileMode.Open);
//                //打开数据文件
//                StreamReader srd = new StreamReader(fs, Encoding.Default);

//                while (srd.Peek() != -1)
//                {
//                    string str = srd.ReadLine();
//                    string[] chara = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
//                    if (chara.Length > 2)
//                    {
//                        #region Camera
//                        if (chara[0] == "Camera")
//                        {
//                            if (chara[1] == "farClipPlane")
//                            {
//                                try
//                                {
//                                    GameObject.Find("Main Camera").GetComponent<Camera>().farClipPlane = Convert.ToInt32(chara[2]);
//                                }
//                                catch (Exception ex)
//                                {
//                                    GeoTools.Log("farClipPlane Error");
//                                    GeoTools.Log(ex.ToString());
//                                }
//                            }
//                            else if (chara[1] == "focusLerpSmooth")
//                            {
//                                try
//                                {
//                                    if (chara[2] == "Infinity")
//                                    {
//                                        GameObject.Find("Main Camera").GetComponent<MouseOrbit>().focusLerpSmooth = float.PositiveInfinity;
//                                    }
//                                    else
//                                    {
//                                        GameObject.Find("Main Camera").GetComponent<MouseOrbit>().focusLerpSmooth = Convert.ToSingle(chara[2]);
//                                    }
//                                }
//                                catch (Exception ex)
//                                {
//                                    GeoTools.Log("focusLerpSmooth Error");
//                                    GeoTools.Log(ex.ToString());
//                                }
//                            }
//                            else if (chara[1] == "fog")
//                            {
//                                try
//                                {
//                                    GameObject.Find("Fog Volume").transform.localScale = new Vector3(0, 0, 0);
//                                }
//                                catch
//                                {
//                                    try
//                                    {
//                                        GameObject.Find("Fog Volume Dark").transform.localScale = new Vector3(0, 0, 0);
//                                    }
//                                    catch
//                                    {
//                                        GeoTools.Log("fog error");
//                                    }
//                                }
//                            }
//                            else if (chara[1] == "SSAO")
//                            {
//                                //if (chara[2] == "OFF")
//                                //{
//                                //    GeoTools.Log("SSAO OFF");
//                                //    OptionsMaster.SSAO = true;
//                                //    FindObjectOfType<ToggleAO>().Set();
//                                //}
//                                //else if (chara[2] == "ON")
//                                //{
//                                //    GeoTools.Log("SSAO ON");
//                                //    OptionsMaster.SSAO = false;
//                                //    FindObjectOfType<ToggleAO>().Set();
//                                //}

//                            }

//                        }
//                        #endregion
//                    }
//                }
//                srd.Close();

//                GeoTools.Log("ReadSceneUI Completed!");
//            }
//            catch (Exception ex)
//            {
//                GeoTools.Log("ReadSceneUI Failed!");
//                GeoTools.Log(ex.ToString());
//                return;
//            }
//        }



        //读取地图地图设定 参数:地图包
        public void ReadSceneSetting(ScenePack scenePack)
        {
            Resources.UnloadUnusedAssets();

            SceneSetting SS = new SceneSetting();

            try
            {
#if DEBUG
                GeoTools.Log(Application.dataPath);
#endif
                if (!File.Exists(scenePack.SettingFilePath))
                {
                    GeoTools.Log("Error! Scene File not exists!");
                    return;
                }

                FileStream fs = new FileStream(scenePack.SettingFilePath, FileMode.Open);
                //打开数据文件
                StreamReader srd = new StreamReader(fs, Encoding.Default);

                while (srd.Peek() != -1)
                {
                    string   str   = srd.ReadLine();
                    string[] chara = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    if (chara.Length > 2)
                    {
                        #region Camera
                        if (chara[0] == nameof(Camera))
                        {
                            if (chara[1] == nameof(Camera.farClipPlane))
                            {
                                try
                                {
                                    GameObject.Find("Main Camera").GetComponent <Camera>().farClipPlane = Convert.ToInt32(chara[2]);
                                }
                                catch (Exception ex)
                                {
                                    GeoTools.Log("farClipPlane Error");
                                    GeoTools.Log(ex.ToString());
                                }
                            }
                            else if (chara[1] == nameof(SS.focusLerpSmooth))
                            {
                                try
                                {
                                    if (chara[2] == "Infinity")
                                    {
                                        GameObject.Find("Main Camera").GetComponent <MouseOrbit>().focusLerpSmooth = float.PositiveInfinity;
                                    }
                                    else
                                    {
                                        GameObject.Find("Main Camera").GetComponent <MouseOrbit>().focusLerpSmooth = Convert.ToSingle(chara[2]);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    GeoTools.Log("focusLerpSmooth Error");
                                    GeoTools.Log(ex.ToString());
                                }
                            }
                            else if (chara[1] == nameof(SS.fog))
                            {
                                try
                                {
                                    GameObject.Find("Fog Volume").transform.localScale = new Vector3(0, 0, 0);
                                }
                                catch
                                {
                                    try
                                    {
                                        GameObject.Find("Fog Volume Dark").transform.localScale = new Vector3(0, 0, 0);
                                    }
                                    catch
                                    {
                                        GeoTools.Log("fog error");
                                    }
                                }
                            }
                            else if (chara[1] == nameof(SceneSetting.SSAO))
                            {
                                //if (chara[2] == "OFF")
                                //{
                                //    GeoTools.Log("SSAO OFF");
                                //    OptionsMaster.SSAO = true;
                                //    FindObjectOfType<ToggleAO>().Set();
                                //}
                                //else if (chara[2] == "ON")
                                //{
                                //    GeoTools.Log("SSAO ON");
                                //    OptionsMaster.SSAO = false;
                                //    FindObjectOfType<ToggleAO>().Set();
                                //}
                            }
                        }
                        #endregion
                    }
                }
                srd.Close();

                GeoTools.Log("ReadSceneSetting Completed!");
            }
            catch (Exception ex)
            {
                GeoTools.Log("ReadSceneSetting Failed!");
                GeoTools.Log(ex.ToString());
                return;
            }
        }
コード例 #20
0
//	public bool expandPrefabs = true;
    public override void OnInspectorGUI()
    {
        CharacterGroup script = (CharacterGroup)target;

        if (GUILayout.Button(new GUIContent("Alignment", "Click to alignment."), EditorStyles.toolbarButton))
        {
            SceneSetting     scene  = FindObjectOfType <SceneSetting>();
            CharacterGroup[] groups = FindObjectsOfType <CharacterGroup>();
            FontAnalyse      font;
            FontData         d;
            float            HCenterY;
            float            desY;
            float            num;
            float            gridSize = GlobalController.instance.setting.gridSize;
            for (int i = 0; i < groups.Length; i++)
            {
                if (groups[i].fontObj == null)
                {
                    continue;
                }
                font = groups[i].fontObj.GetComponent <FontAnalyse>();
                if (font.fontDatas.TryGetValue((int)'H', out d))
                {
                    HCenterY = groups[i].transform.position.y - d._actualOffsetY + (1 - groups[i].pivot.y) * font.lineHeight;
                    num      = Mathf.Floor(HCenterY / gridSize);
                    desY     = num * gridSize + gridSize * 0.5f - HCenterY;
                    groups[i].transform.position = new Vector3(groups[i].transform.position.x, groups[i].transform.position.y + desY, groups[i].transform.position.z);

                    desY = groups[i].transform.position.x - groups[i].pivot.x * groups[i].textWidth;
                    if (desY < scene.boundsX.x)
                    {
                        scene.boundsX.x = desY;
                    }

                    desY = groups[i].transform.position.x + (1 - groups[i].pivot.x) * groups[i].textWidth;
                    if (desY > scene.boundsX.y)
                    {
                        scene.boundsX.y = desY;
                    }

                    desY = groups[i].transform.position.y - groups[i].pivot.y * groups[i].analyse.lineHeight;
                    if (desY < scene.boundsY.x)
                    {
                        scene.boundsY.x = desY;
                    }

                    desY = groups[i].transform.position.y + (1 - groups[i].pivot.y) * groups[i].analyse.lineHeight;
                    if (desY > scene.boundsY.y)
                    {
                        scene.boundsY.y = desY;
                    }
                }
            }

            scene.boundsX.x -= GlobalController.instance.setting.gridSize;
            scene.boundsX.y += GlobalController.instance.setting.gridSize;
            scene.boundsY.x -= GlobalController.instance.setting.gridSize;
            scene.boundsY.y += GlobalController.instance.setting.gridSize;
        }

        script.contentStr            = EditorGUILayout.TextField("contentStr", script.contentStr);
        script.fontObj               = (Transform)EditorGUILayout.ObjectField("fontObj", script.fontObj, typeof(Transform));
        script.pivot                 = EditorGUILayout.Vector2Field("pivot", script.pivot);
        script.color                 = EditorGUILayout.ColorField("color", script.color);
        script.createColliderForChar = EditorGUILayout.Toggle("createCollider", script.createColliderForChar);
//		this.expandPrefabs = PGEditorUtils.SerializedObjFoldOutList<CharacterCell>
//			(
//				"Per-Prefab Pool Options",
//				script._character,
//				this.expandPrefabs,
//				ref script._editorListItemStates,
//				true
//			);

        // Flag Unity to save the changes to to the prefab to disk
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
コード例 #21
0
ファイル: GameEditor.cs プロジェクト: kidsang/ProjectJ
        public void LoadMap(SceneSetting data, string path = null)
        {
            if (Map)
                Map.Dispose();

            GameObject mapRoot = new GameObject("MapRoot");
            mapRoot.transform.SetParent(sceneRoot.transform);
            mapRoot.transform.SetSiblingIndex(0);

            Map = mapRoot.AddComponent<EditorMap>();
            Map.New(data.Map);

            SceneDataProxy.Instance.Load(data, path);

            fileModified = false;
            filePath = path;
            ChangeWindowTitle();
        }
コード例 #22
0
ファイル: SceneDataProxy.cs プロジェクト: kidsang/ProjectJ
 public void Load(SceneSetting data, string path = null)
 {
     DataPath = path;
     repo.New(data, EditorEvent.MAP_LOAD, null);
 }
コード例 #23
0
 /// <summary>
 /// ゲームオーバーのカウントをリセットする時の処理
 /// </summary>
 void ResetGameOverCount()
 {
     sceneSetting       = null;
     levelGameOverCount = 0;
 }
コード例 #24
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            if (KickStarter.sceneSettings == null)
            {
                return;
            }

            sceneSetting = (SceneSetting)EditorGUILayout.EnumPopup("Scene setting to change:", sceneSetting);

            if (sceneSetting == SceneSetting.DefaultNavMesh)
            {
                if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider)
                {
                    if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider)
                    {
                        changeNavMeshMethod = (ChangeNavMeshMethod)EditorGUILayout.EnumPopup("Change NavMesh method:", changeNavMeshMethod);
                    }

                    if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || changeNavMeshMethod == ChangeNavMeshMethod.ChangeNavMesh)
                    {
                        parameterID = Action.ChooseParameterGUI("New NavMesh:", parameters, parameterID, ParameterType.GameObject);
                        if (parameterID >= 0)
                        {
                            constantID = 0;
                            newNavMesh = null;
                        }
                        else
                        {
                            newNavMesh = (NavigationMesh)EditorGUILayout.ObjectField("New NavMesh:", newNavMesh, typeof(NavigationMesh), true);

                            constantID = FieldToID <NavigationMesh> (newNavMesh, constantID);
                            newNavMesh = IDToField <NavigationMesh> (newNavMesh, constantID, false);
                        }
                    }
                    else if (changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles)
                    {
                        holeAction = (InvAction)EditorGUILayout.EnumPopup("Add or remove hole:", holeAction);
                        string _label = "Hole to add:";
                        if (holeAction == InvAction.Remove)
                        {
                            _label = "Hole to remove:";
                        }

                        parameterID = Action.ChooseParameterGUI(_label, parameters, parameterID, ParameterType.GameObject);
                        if (parameterID >= 0)
                        {
                            constantID = 0;
                            hole       = null;
                        }
                        else
                        {
                            hole = (PolygonCollider2D)EditorGUILayout.ObjectField(_label, hole, typeof(PolygonCollider2D), true);

                            constantID = FieldToID <PolygonCollider2D> (hole, constantID);
                            hole       = IDToField <PolygonCollider2D> (hole, constantID, false);
                        }

                        if (holeAction == InvAction.Replace)
                        {
                            replaceParameterID = Action.ChooseParameterGUI("Hole to remove:", parameters, replaceParameterID, ParameterType.GameObject);
                            if (replaceParameterID >= 0)
                            {
                                replaceConstantID = 0;
                                replaceHole       = null;
                            }
                            else
                            {
                                replaceHole = (PolygonCollider2D)EditorGUILayout.ObjectField("Hole to remove:", replaceHole, typeof(PolygonCollider2D), true);

                                replaceConstantID = FieldToID <PolygonCollider2D> (replaceHole, replaceConstantID);
                                replaceHole       = IDToField <PolygonCollider2D> (replaceHole, replaceConstantID, false);
                            }
                        }
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("This action is not compatible with the Unity Navigation pathfinding method, as set in the Scene Manager.", MessageType.Warning);
                }
            }
            else if (sceneSetting == SceneSetting.DefaultPlayerStart)
            {
                parameterID = Action.ChooseParameterGUI("New default PlayerStart:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID  = 0;
                    playerStart = null;
                }
                else
                {
                    playerStart = (PlayerStart)EditorGUILayout.ObjectField("New default PlayerStart:", playerStart, typeof(PlayerStart), true);

                    constantID  = FieldToID <PlayerStart> (playerStart, constantID);
                    playerStart = IDToField <PlayerStart> (playerStart, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.SortingMap)
            {
                parameterID = Action.ChooseParameterGUI("New SortingMap:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    sortingMap = null;
                }
                else
                {
                    sortingMap = (SortingMap)EditorGUILayout.ObjectField("New SortingMap:", sortingMap, typeof(SortingMap), true);

                    constantID = FieldToID <SortingMap> (sortingMap, constantID);
                    sortingMap = IDToField <SortingMap> (sortingMap, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.TintMap)
            {
                parameterID = Action.ChooseParameterGUI("New TintMap:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    tintMap    = null;
                }
                else
                {
                    tintMap = (TintMap)EditorGUILayout.ObjectField("New TintMap:", tintMap, typeof(TintMap), true);

                    constantID = FieldToID <TintMap> (tintMap, constantID);
                    tintMap    = IDToField <TintMap> (tintMap, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.OnLoadCutscene)
            {
                parameterID = Action.ChooseParameterGUI("New OnLoad cutscene:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    cutscene   = null;
                }
                else
                {
                    cutscene = (Cutscene)EditorGUILayout.ObjectField("New OnLoad custscne:", cutscene, typeof(Cutscene), true);

                    constantID = FieldToID <Cutscene> (cutscene, constantID);
                    cutscene   = IDToField <Cutscene> (cutscene, constantID, false);
                }
            }
            else if (sceneSetting == SceneSetting.OnStartCutscene)
            {
                parameterID = Action.ChooseParameterGUI("New OnStart cutscene:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    cutscene   = null;
                }
                else
                {
                    cutscene = (Cutscene)EditorGUILayout.ObjectField("New OnStart cutscene:", cutscene, typeof(Cutscene), true);

                    constantID = FieldToID <Cutscene> (cutscene, constantID);
                    cutscene   = IDToField <Cutscene> (cutscene, constantID, false);
                }
            }

            AfterRunningOption();
        }
コード例 #25
0
 /// <summary>
 /// ステージ数を更新する
 /// </summary>
 void UpdateStageNum()
 {
     sceneSetting = GameObject.FindGameObjectWithTag(TagName.SceneSettings).GetComponent <SceneSetting>();
     text.text    = sceneSetting.StageNumber.ToString();
 }