void EndStep()
    {
        Debug.Log("PractiseStep, End step:" + curStep.ID + " Success:" + !stepFailed);

        if (!stepFailed)
        {
            EndObjective();
        }

        stepFinished = false;

        plot.Hide();
        guideTip.Hide();
        foreach (GameObject tip in tipOnScene)
        {
            DestroyUIEffect(tip);
        }
        tipOnScene.Clear();
        foreach (GameObject effect in effects)
        {
            Object.DestroyImmediate(effect);
        }
        effects.Clear();
        if (curStep.disabledAction != null && InputReader.Instance.player != null)
        {
            foreach (Command cmd in curStep.disabledAction)
            {
                InputReader.Instance.player.m_skillSystem.CancelDisableCommand(cmd);
            }
        }
        UnhighlightButton();

        readyStepID = stepFailed ? curStep.failNext : curStep.next;
        Debug.Log("PractiseStep, Ready step:" + readyStepID);
        curStep = null;
        if (!stepFailed && readyStepID == 0)
        {
            StartCoroutine(Step_Over());
        }
    }
Ejemplo n.º 2
0
 override public void OnExit()
 {
     plotUI.Hide();
 }
    protected override void OnFirstStart()
    {
        base.OnFirstStart();

        plot = UIManager.Instance.CreateUI("UIPlayPlot").GetComponent <UIPlayPlot>();
        plot.Hide();
        plot.onNext = OnPlotNext;

        match.HideSignal();
        match.HideTitle();
        match.HideBackButton();

        guideTip = UIManager.Instance.CreateUI("GuideTip_3").AddMissingComponent <GuideTip>();
        guideTip.transform.localPosition = new Vector3(18, -316, 0);
        guideTip.firstButtonVisible      = false;
        guideTip.Hide();


        foreach (UController.Button btn in match.m_uiController.m_btns)
        {
            if (btn.btn != null)
            {
                UIEventListener.Get(btn.btn.gameObject).onPress += OnBtnPress;
            }
        }

        match.onTipClick += OnTipClick;
        ball.onGrab      += OnGrab;
        ball.onCatch     += OnCatch;
        ball.onShoot     += OnShoot;
        ball.onHitGround += OnHitGround;
        match.mCurScene.mBasket.onGoal += OnGoal;

        prefabObjFinish = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/MatchGuideObjectiveFinish") as GameObject;
        paneObjective   = UIManager.Instance.CreateUI("MatchGuideObjectivePane");
        UIGrid     gridObj    = paneObjective.transform.FindChild("Grid").GetComponent <UIGrid>();
        GameObject prefabItem = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/MatchGuideObjectiveItem") as GameObject;

        PractiseStep step = GameSystem.Instance.PractiseStepConfig.GetFirstStep();

        readyStepID = step.ID;
        while (true)
        {
            if (step.startObjective.Key != 0)
            {
                lastObjID = step.startObjective.Key;
                GameObject item = CommonFunction.InstantiateObject(prefabItem, gridObj.transform);
                item.GetComponentInChildren <UILabel>().text = step.startObjective.Value;
                objectives.Add(step.startObjective.Key, item);
            }
            if (step.next == 0)
            {
                break;
            }
            else
            {
                step = GameSystem.Instance.PractiseStepConfig.GetStep(step.next);
            }
        }
        gridObj.Reposition();
    }