Пример #1
0
    public override void Init(GameModeInitData initData)
    {
        fakeZhiboMode2Skill();



        mUIMgr     = GameMain.GetInstance().GetModule <UIMgr>();
        mResLoader = GameMain.GetInstance().GetModule <ResLoader>();
        mCardMdl   = GameMain.GetInstance().GetModule <CardDeckModule>();
        pRoleMgr   = GameMain.GetInstance().GetModule <RoleModule>();
        //mSkillMdl = GameMain.GetInstance().GetModule<SkillTreeMgr>();

        state = new ZhiboGameMode2State();

        state.Hp          = 100;
        state.MaxHp       = 100;
        state.Enegy       = 0;
        state.MaxEnegy    = 100;
        state.EnegyPerSec = 1f;

        state.OriginTime  = 100;
        state.TimeLeft    = 100;
        state.Score       = 0;
        state.TargetScore = 1000;

        state.DanmuFreq = 3f;
        state.savedFreq = state.DanmuFreq;

        state.NowSuperDanmuIdx = 0;

        state.ArmorTimer = 0f;

        spdRate     = 1.0f;
        lastTick    = 0;
        nextTick    = 0;
        bigOneNext  = 3;
        bigOneCount = 0;



        LoadDanmuDict();

        mUICtrl = mUIMgr.ShowPanel("ZhiboPanelMode2") as ZhiboMode2UICtrl;

        mUICtrl.UpdateTargetScore();

        InitSuperDanmu();


        FightDanmuGMInitData realData = initData as FightDanmuGMInitData;

        if (realData != null)
        {
            SetPresetInfo(realData.SkillList);
        }
    }
Пример #2
0
    public override void RegisterEvent()
    {
        view.FightDanmuBtn.onClick.AddListener(delegate()
        {
            ICoreManager cm = GameMain.GetInstance().GetModule <CoreManager>();
            mUIMgr.CloseCertainPanel(this);
            FightDanmuGMInitData data = new FightDanmuGMInitData();
            data.SkillList            = new List <string>();
            data.SkillList.Add("0");
            data.SkillList.Add("1");
            data.SkillList.Add("2");
            data.SkillList.Add("3");
            view.FightDanmuBtn.gameObject.SetActive(false);
            cm.ChangeScene("FightDanmu", data);
        });


        view.NextStage.onClick.AddListener(delegate()
        {
            ICoreManager cm = GameMain.GetInstance().GetModule <CoreManager>();
            mUIMgr.CloseCertainPanel(this);
            cm.ChangeScene("Zhibo", null, null);
        });

        view.ScheduleBtn.onClick.AddListener(delegate()
        {
            //mUIMgr.ShowPanel("SchedulePanel");
            mUIMgr.ShowPanel("SchedulePanel2");
        });
        view.InspectBtn.onClick.AddListener(delegate()
        {
            mUIMgr.ShowPanel("CardsMgr");
        });

        {
            ClickEventListerner listener = view.PhoneMiniIcon.gameObject.GetComponent <ClickEventListerner>();
            if (listener == null)
            {
                listener = view.PhoneMiniIcon.gameObject.AddComponent <ClickEventListerner>();
                listener.OnClickEvent += delegate(PointerEventData eventData) {
                    view.PhoneBigPic.gameObject.SetActive(true);
                    view.PhoneMiniIcon.gameObject.SetActive(false);
                    AddMask(view.Mask1);

                    view.PhoneBigPic.transform.localScale = new Vector3(0.3f, 0.3f, 1f);
                    Tween tween = DOTween.To
                                  (
                        () => view.PhoneBigPic.transform.localScale,
                        (x) => view.PhoneBigPic.transform.localScale = x,
                        new Vector3(1f, 1f, 1f),
                        0.3f
                                  );
                };
            }
        }

        {
            ClickEventListerner listener = view.Close.gameObject.GetComponent <ClickEventListerner>();
            if (listener == null)
            {
                listener = view.Close.gameObject.AddComponent <ClickEventListerner>();
                listener.OnClickEvent += delegate(PointerEventData eventData) {
                    //check position of the phone
                    if (closeCtr)
                    {
                        {
                            Tween tween = DOTween.To
                                          (
                                () => view.PhoneBigPic.rectTransform.anchoredPosition,
                                (x) => view.PhoneBigPic.rectTransform.anchoredPosition = x,
                                new Vector2(778, -285),
                                0.3f
                                          );
                        }
                        closeCtr = false;
                        //mUIMgr.CloseCertainPanel();
                    }
                    view.PhoneBigPic.gameObject.SetActive(false);
                    view.PhoneMiniIcon.gameObject.SetActive(true);
                    CloseLastMask();
                };
            }
        }

        foreach (AppView vv in view.appViews)
        {
            ClickEventListerner listener = vv.root.gameObject.GetComponent <ClickEventListerner>();
            if (listener == null)
            {
                listener = vv.root.gameObject.AddComponent <ClickEventListerner>();
                listener.OnClickEvent += delegate(PointerEventData eventData) {
                    OpenApp(vv);
                    AddMask(view.Mask2);
                };
            }
        }
    }