コード例 #1
0
ファイル: PauseMgr.cs プロジェクト: beuoon/FILO
    public PauseMgr(GoalMgr goalMgr, Action onPauseAction, Action onResumeAction, Action onGameExitAction)
    {
        this.onPauseAction    = onPauseAction;
        this.onResumeAction   = onResumeAction;
        this.onGameExitAction = onGameExitAction;

        GoalPrefab = Resources.Load <GameObject>("Prefabs/UI/Pause_Goal");

        pauseCanvas         = GameObject.Find("UICanvas").transform.Find("PauseCanvas").GetComponent <Canvas>();
        pauseCanvas.enabled = false;

        menuTF   = pauseCanvas.transform.Find("Menu");
        paper1TF = pauseCanvas.transform.Find("Paper1");
        paper2TF = pauseCanvas.transform.Find("Paper2");
        radioTF  = pauseCanvas.transform.Find("Radio");

        menuInitPos   = menuTF.position;
        paper1InitPos = paper1TF.position;
        paper2InitPos = paper2TF.position;
        radioInitPos  = radioTF.position;

        menuMoveAmount   = new Vector3(638, 0);
        paper1MoveAmount = new Vector3(-100, 765);
        paper2MoveAmount = new Vector3(0, 768);
        radioMoveAmount  = new Vector3(-271, 0);

        // Paper
        Vector3     goalPos  = paper2TF.transform.position + new Vector3(-200, 180);
        List <Goal> goalList = goalMgr.GetMainGoals();

        goalList.AddRange(goalMgr.GetSubGoals());

        foreach (Goal goal in goalList)
        {
            GameObject goalObj = GameObject.Instantiate(GoalPrefab, goalPos, Quaternion.identity, paper2TF);
            goalObj.GetComponent <Text>().text = goal.GetExplanationText();
            goalObj.transform.Find("Status").GetComponent <Text>().text = goal.GetStatusText();

            goalPos.y += GOAL_POS_INTERVAL_Y;
        }

        // Menu
        menuHeader = menuTF.Find("Header").gameObject;
        Transform itemsTF = pauseCanvas.transform.Find("Menu").Find("Items");

        for (int i = 0; i < itemsTF.childCount; i++)
        {
            menuPosList.Add(itemsTF.GetChild(i).position);
        }

        // Sure
        sureCanvas         = pauseCanvas.transform.Find("SureCanvas").GetComponent <Canvas>();
        sureCanvas.enabled = false;

        sureCanvas.transform.Find("Window").Find("Yes").GetComponent <Button>().onClick.AddListener(Sure_Yes);
        sureCanvas.transform.Find("Window").Find("No").GetComponent <Button>().onClick.AddListener(Sure_No);
    }
コード例 #2
0
    private void StageEnd()
    {
        if (!bStageEndSetup)
        {
            if (goalMgr.IsAllSatisfied())
            {
                reportCanvas.enabled = true;
                report = new Report(reportCanvas.gameObject, goalMgr.GetMainGoals(), goalMgr.GetSubGoals(), gameInfo);

                GameData gameData = new GameData();
                gameData.Money += report.Reward;
                gameData.SetRank(_stage, report.Rank);
                gameData.Save();
            }
            else
            {
                stageEnd.SetActive(true);
                stageEndText.text = "임무 실패";
            }

            bStageEndSetup = true;
        }
        BGM.Stop();
    }