Ejemplo n.º 1
0
    public void Init()
    {
        this.uiInGame = GameObject.FindObjectOfType <UIInGame>();

        Debug.Log("InGame: Init");
        this.uiInGame.Init();
        for (int i = 0; i < this.uiInGame.arrUiBinderMission.Length; i++)
        {
            var uiBinderMission = this.uiInGame.arrUiBinderMission[i];
            var idx             = i;


            uiBinderMission.OnClick = (id) =>
            {
                InfoManager.GetInstance().DoMission(id, 1);

                //info변경이 없으면 ui업데이트를 안함
                this.uiInGame.UpdateUI();
            };
        }
        this.uiInGame.btnSave.onClick.AddListener(() =>
        {
            GameInfo gameInfo = InfoManager.GetInstance().gameInfo;
            string json       = JsonConvert.SerializeObject(gameInfo);
            File.WriteAllText(Application.persistentDataPath + "/gameInfo.json", json);
            Debug.Log(json);
            Debug.Log("save");
        });
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        //App 오브젝트를 씬 넘어가도 지우지 말어라
        DontDestroyOnLoad(this.gameObject);
        DataManager.GetInstance().Load();
        InfoManager.GetInstance().Init();

        string path = Application.persistentDataPath + "/gameInfo.json";

        if (File.Exists(path))
        {
            string   LoadJson = File.ReadAllText(path);
            GameInfo gameInfo = JsonConvert.DeserializeObject <GameInfo>(LoadJson);
            InfoManager.GetInstance().Init(gameInfo);
        }
        else
        {
            InfoManager.GetInstance().Init();

            List <MissionData> missionDataList = DataManager.GetInstance().GetMissionData();
            foreach (var data in missionDataList)
            {
                MissionInfo info = new MissionInfo(data.id, 0);
                InfoManager.GetInstance().gameInfo.missionInfoList.Add(info);
            }
        }
        //Title 씬으로 바꾸기
        this.ChangeScene(eSceneState.Title);
    }
Ejemplo n.º 3
0
    private void StageClear(int userStageLevel, int currentStageLevel)
    {
        //내 레벨이 스테이지 레벨과 같을 경우 레벨업을 한다.
        if (userStageLevel == currentStageLevel)
        {
            var infoManager = InfoManager.GetInstance();
            infoManager.SaveUserInfo(true);
        }

        //클리어 메시지와 클리어 UI 설정
        var dataManager = DataManager.GetInstance();

        if (currentStageLevel == dataManager.dicStageData.Count)
        {
            var rtRegameKey = (RectTransform)this.btnRegameKey.transform;
            rtRegameKey.sizeDelta = new Vector3(180, 180);
            this.btnRegameKey.transform.localPosition = new Vector3(-120, -120, 0);
            var rtHomeKey = (RectTransform)this.btnHomeKey.transform;
            rtHomeKey.sizeDelta = new Vector3(180, 180);
            this.btnHomeKey.transform.localPosition = new Vector3(120, -120, 0);
        }
        else
        {
            this.btnNextStage.gameObject.SetActive(true);
            var rtRegameKey = (RectTransform)this.btnRegameKey.transform;
            rtRegameKey.sizeDelta = new Vector3(180, 180);
            this.btnRegameKey.transform.localPosition = new Vector3(-240, -120, 0);
            var rtHomeKey = (RectTransform)this.btnHomeKey.transform;
            rtHomeKey.sizeDelta = new Vector3(180, 180);
            this.btnHomeKey.transform.localPosition = new Vector3(0, -120, 0);
        }
        this.buttons.SetActive(false);
        this.clearMessage.SetActive(true);
    }
Ejemplo n.º 4
0
    void Start()
    {
        gameMgr = GameManager.GetInstance();
        Info    = InfoManager.GetInstance().Player;

        PS = PlayerState.IDEL;
        StartCoroutine(this.CheckPlayerState());
        StartCoroutine("WalkEffect");
    }
Ejemplo n.º 5
0
    public void UpdateUI()
    {
        List <MissionInfo> missionInfoList = InfoManager.GetInstance().gameInfo.missionInfoList;

        for (int i = 0; i < arrUiBinderMission.Length; i++)
        {
            UIBinder_Mission uiBinderMission = this.arrUiBinderMission[i];
            MissionInfo      info            = missionInfoList[i];
            uiBinderMission.UpdateUI(info.Count);
        }
    }
Ejemplo n.º 6
0
    private void ReadFile(bool mainThread)
    {
        StreamReader sr           = new StreamReader(fullPath + "/" + fileName);
        string       fileContents = sr.ReadToEnd();

        sr.Close();

        List <string> infos = new List <string>();

        string[] lines = fileContents.Split("\n"[0]);
        foreach (string line in lines)
        {
            // not a comment line
            if (!line.Contains("#"))
            {
                infos.Add(line);
            }
        }

        for (int i = 0; i < infos.Count; i++)
        {
            if (!infos[i].Contains("="))
            {
                // white line
            }
            else
            {
                string[] TheInfo = infos[i].Split('=');

                switch (TheInfo[0])
                {
                case "Exemple":
                    // DO STUFF with TheInfo[1]
                    break;

                case "Vsync":
                    InfoManager.GetInstance().TryReadVSyncValue(TheInfo[1], TheInfo[0]);
                    break;

                case "ReadQuestFile":
                    if (mainThread)
                    {
                        QuestManager.GetInstance().SetReadquestFile(TheInfo[1], TheInfo[0]);
                    }
                    break;
                }
            }
        }
    }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        player    = GameManager.GetInstance().GetPlayer();
        _wayPoint = new Vector3[_wayPointCount];
        anim      = GetComponent <Animator>();
        nav       = this.gameObject.GetComponent <NavMeshAgent>();
        Init();
        WayPointInit();
        _stateMachine = new StateMachine <EnumyState>();
        _stateMachine.Change(this, GameManager.GetInstance().enemyStateManager.GetEnemyState(STATE_TYPE.STATE_PATROL));

        Info = InfoManager.GetInstance().Enemy;

        StartCoroutine("PlaySound");
    }
Ejemplo n.º 8
0
    public void Init()
    {
        List <MissionData> missionDatasList = DataManager.GetInstance().GetMissionData();
        List <MissionInfo> missionInfoList  = InfoManager.GetInstance().gameInfo.missionInfoList;

        for (int i = 0; i < arrUiBinderMission.Length; i++)
        {
            UIBinder_Mission uiBinderMission = this.arrUiBinderMission[i];
            MissionData      data            = missionDatasList[i];

            MissionInfo info    = missionInfoList[i];
            string      btnName = string.Format(data.name, data.goal);
            uiBinderMission.Init(data.id, btnName, data.goal, info.Count);
        }
    }
Ejemplo n.º 9
0
    public void Init(string name = "", int prefabId = 0)
    {
        /*var dataManager = DataManager.GetInstance();
         * dataManager.LoadAllData();*///아직은 데이터 필요없음

        #region Info
        var infoManager = InfoManager.GetInstance();
        infoManager.LoadInfo();
        var userInfo       = infoManager.GetUserInfo();
        var userStageLevel = userInfo.stageLevel;
        #endregion

        this.SetBtnStage(userStageLevel);

        for (int i = 0; i < this.btnStages.Length; i++)
        {
            int btnIndex = i;
            btnStages[btnIndex].onClick.AddListener(() => this.LoadStageScene(btnIndex));
        }
    }
Ejemplo n.º 10
0
    public void Init()
    {
        Debug.Log("Title Init");



        //완료는 했지만 보상을 받지 않은 missionInfo들....
        var missionInfoList = InfoManager.GetInstance().gameInfo.missionInfoList
                              .Where(x => x.IsComplete && !x.IsGetReward).ToList();

        foreach (var info in missionInfoList)
        {
            Debug.LogFormat("<color=red>{0} {1} {2}</color>", info.Id, info.IsComplete, info.IsGetReward);
        }

        if (missionInfoList.Count > 0)
        {
            this.uiTitle.ShowNotificationShopIcon();
        }
        else
        {
            this.uiTitle.HideNotificationShopIcon();
        }

        InfoManager.GetInstance().OnCompleteMission = (id) =>
        {
            Debug.LogFormat("미션 {0} 완료 됨!");
        };

        Debug.Log(this.uiTitle);

        this.uiTitle.btnStart.onClick.AddListener(() =>
        {
            //플레이 버튼을 누르면 대리자 호출
            this.onClickGameStart();
        });
    }
Ejemplo n.º 11
0
    public void InitStage(int stageId)
    {
        this.stageId = stageId;
        Debug.LogFormat("불러온 스테이지 id : {0}", this.stageId);
        //stageNum에 맞는 스테이지 불러와서 실행

        #region Data
        var dataManager = DataManager.GetInstance();
        var stageData   = dataManager.dicStageData[this.stageId];
        #endregion

        #region Info
        var infoManager    = InfoManager.GetInstance();
        var userInfo       = infoManager.GetUserInfo();
        var userStageLevel = userInfo.stageLevel;
        #endregion

        #region Stage Reset
        this.cube.transform.position = new Vector3(0, 1, 0);
        this.SetStageMap(stageData.path);
        this.SetCamara(stageData.cameraX, stageData.cameraY, stageData.cameraZ);

        this.btnStart.gameObject.SetActive(true);
        this.buttons.SetActive(false);
        this.cube.isMoveWait = false;

        this.SetDefeat(stageData.maxMove, stageData.timeLimit);
        #endregion Stage Reset

        this.cube.onMoveCount = () =>
        {
            this.MoveCounting();
        };
        this.cube.onGameClear = () =>
        {
            if (this.isFaeiled == false)
            {
                this.isClear = true;
                this.objTxtMove.SetActive(false);
                this.objTxtTime.SetActive(false);
                this.StageClear(userStageLevel, stageData.stageLevel);
                this.txtTimeLimit.gameObject.SetActive(false);
                this.txtCurrentMove.gameObject.SetActive(false);
                this.txtMaxMove.gameObject.SetActive(false);
            }
        };
        this.cube.onGameFailed = () =>
        {
            if (this.isClear == false)
            {
                this.isFaeiled = true;
                this.objTxtMove.SetActive(false);
                this.objTxtTime.SetActive(false);
                this.StageFailed(userStageLevel, stageData.stageLevel);
                this.txtTimeLimit.gameObject.SetActive(false);
                this.txtCurrentMove.gameObject.SetActive(false);
                this.txtMaxMove.gameObject.SetActive(false);
            }
        };

        #region Button
        this.btnStart.onClick.AddListener(() =>
        {
            this.btnStart.gameObject.SetActive(false);
            this.buttons.SetActive(true);
            this.cube.isMoveWait = true;
            StartCoroutine(this.MoveCamera());
            StartCoroutine(this.Timer());
        });

        this.btnRegameKey.onClick.AddListener(() =>
        {
            Debug.Log("다시하기");
            GameSceneManager.GetInstance().LoadScene(4, this.stageId);
        });

        this.btnHomeKey.onClick.AddListener(() =>
        {
            Debug.Log("난이도 선택");
            GameSceneManager.GetInstance().LoadScene(3);
        });

        this.btnNextStage.onClick.AddListener(() =>
        {
            Debug.LogFormat("다음 단계 : {0}", this.stageId + 1);
            GameSceneManager.GetInstance().LoadScene(4, this.stageId + 1);
        });
        #endregion
    }