// Use this for initialization
    void Start()
    {
        _Instance = this;
        GameTextType gameTextVal = GlobalData.GetGameTextMode();

        switch (gameTextVal)
        {
        case GameTextType.Chinese:
            Leve1Texture = Leve1TextureCh;
            Leve2Texture = Leve2TextureCh;
            LinkTexture  = LinkTextureCh;
            break;

        case GameTextType.English:
            Leve1Texture = Leve1TextureEn;
            Leve2Texture = Leve2TextureEn;
            LinkTexture  = LinkTextureEn;
            break;
        }

        Leve1UITexture = Leve1.GetComponent <UITexture>();
        Leve2UITexture = Leve2.GetComponent <UITexture>();
//		Leve1UI=Leve1.GetComponent<UISprite>() as UISprite;
//		Leve2UI=Leve2.GetComponent<UISprite>() as UISprite;
        Leve1Hover   = Leve1.GetComponents <TweenRotation>()[0] as TweenRotation;
        Leve1Unhover = Leve1.GetComponents <TweenRotation>()[1] as TweenRotation;
        Leve2Hover   = Leve2.GetComponents <TweenRotation>()[0] as TweenRotation;
        Leve2UnHover = Leve2.GetComponents <TweenRotation>()[1] as TweenRotation;

        GlobalData.GetInstance().gameLeve = GameLeve.Leve1;
        Leve1UITexture.mainTexture = Leve1Texture[0];
        Leve2UITexture.mainTexture = Leve2Texture[0];
        //Leve1UI.spriteName="diYiGuanHuiSe";
        //Leve2UI.spriteName="diErGuanHuiSe";

        Leve1Hover.ResetToBeginning();
        Leve2UnHover.ResetToBeginning();

        Leve1Hover.PlayForward();
        Leve2UnHover.PlayForward();

        Starts.SetActive(false);
        pcvr.StartLightStateP1 = LedState.Mie;
        isInitCartoon          = false;

        if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode && NetCtrlScript == null)
        {
            GameObject netCtrl = GameObject.Find(GlobalData.netCtrl);
            if (netCtrl != null)
            {
                NetCtrlScript = netCtrl.GetComponent <NetCtrl>();
            }
        }

        if (GlobalData.GetInstance().gameMode != GameMode.OnlineMode)
        {
            OpenCityLevelUI();
        }

        InputEventCtrl.GetInstance().ClickStartBtEvent += clickStartBtEvent;
    }
    // Update is called once per frame
    void Update()
    {
        if (bIsSelectLeve)
        {
            return;
        }

        selectTime += Time.deltaTime;
        if (StartSenceChangeUI.IsChangeGameLevel)
        {
            float hor = InputEventCtrl.PlayerFX[0];
            if (Mathf.Abs(hor) > 0.3f)
            {
                if (SelectObj.activeSelf)
                {
                    SelectObj.SetActive(false);
                    StartCoroutine(DelayOpenStartBt());
                    //Starts.SetActive(true);
                    pcvr.StartLightStateP1 = LedState.Shan;
                }
//				bIsClickStartBt = true;

                if (hor > 0f)
                {
                    if (GlobalData.GetInstance().gameLeve != GameLeve.Leve2 || selectTime > TimeSLMax)
                    {
                        selectTime = 0.0f;
                        AudioManager.Instance.PlaySFX(ChangeLeveAudio);
                    }
                    GlobalData.GetInstance().gameLeve = GameLeve.Leve2;
                    //ScreenLog.Log("1      " + GlobalData.GetInstance().gameLeve);
                }
                else if (hor < 0f)
                {
                    if (GlobalData.GetInstance().gameLeve != GameLeve.Leve1 || selectTime > TimeSLMax)
                    {
                        selectTime = 0.0f;
                        AudioManager.Instance.PlaySFX(ChangeLeveAudio);
                    }
                    GlobalData.GetInstance().gameLeve = GameLeve.Leve1;
                    //ScreenLog.Log("2     " + GlobalData.GetInstance().gameLeve);
                }
                Leve1Hover.ResetToBeginning();
                Leve1Unhover.ResetToBeginning();
                Leve2Hover.ResetToBeginning();
                Leve2UnHover.ResetToBeginning();
                SelectLeve();
            }
        }

        if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode && NetCtrlScript.GetSelectGameLevel() != GameLeve.None)
        {
            timeDelay += Time.deltaTime;             //make server first into game
            if (timeDelay >= 0.5f && !bIsSelectLeve)
            {
                ScreenLog.Log("OnlineMode -> clickStartBt...");
//				bIsClickStartBt = true;
                clickStartBt(1);
            }
        }
    }
Esempio n. 3
0
    private GameObject currentGO; //用于得到当前是哪张技能卡片
    void OncClickSkillCard()      //点击卡片放大方法
    {
        list_Go.Clear();
        NextSceneBtn.GetComponent <UIButton>().enabled = false;
        Vector3    vt = new Vector3(0.45f, 0.85f, 3.5f);
        Vector3    vr = new Vector3(0, 180, 0);
        GameObject gc = UIButton.current.gameObject;

        AddGOToList();
        for (int i = 0; i < list_Go.Count; i++)
        {
            if (gc.name == list_Go[i].name)
            {
                list_Go.Remove(list_Go[i]);
                for (int j = 0; j < list_Go.Count; j++)
                {
                    if (list_Go[j].transform.localPosition == vt)
                    {
                        return;
                    }
                }
            }
        }
        for (int i = 0; i < cardContainer.transform.childCount; i++)
        {
            if (UIButton.current.name == cardContainer.transform.GetChild(i).name)
            {
                index = i;
                break;
            }
        }
        if (gc.transform.localPosition != vt)
        {
            currentGO = gc;
            LightName(currentGO);
            TweenPosition tp = gc.GetComponent <TweenPosition>();
            tp.enabled  = true;
            tp.delay    = 0.2f;
            tp.duration = 0.3f;
            tp.onFinished.Clear();
            tp.from = gc.transform.localPosition;
            tp.to   = vt;
            tp.ResetToBeginning();

            TweenRotation tr = gc.GetComponent <TweenRotation>();
            tr.enabled  = true;
            tr.delay    = 0.2f;
            tr.duration = 0.3f;
            tr.onFinished.Clear();
            tr.from = gc.transform.localRotation.eulerAngles;
            tr.to   = vr;
            tr.ResetToBeginning();

            tr.onFinished.Add(new EventDelegate(SetChoseBtnStart));
        }
        else
        {
            TweenPosition tp = gc.GetComponent <TweenPosition>();
            tp.enabled  = true;
            tp.delay    = 0.2f;
            tp.duration = 0.3f;
            tp.onFinished.Clear();
            tp.from = vt;
            tp.to   = backV_List[index];
            tp.ResetToBeginning();

            TweenRotation tr = gc.GetComponent <TweenRotation>();
            tr.enabled  = true;
            tr.delay    = 0.2f;
            tr.duration = 0.3f;
            tr.onFinished.Clear();
            tr.from = vr;
            tr.to   = backR_List[index];
            tr.ResetToBeginning();

            tr.onFinished.Add(new EventDelegate(SetChoseBtnClose));
        }
    }
Esempio n. 4
0
    void CardMoveToScreen_2()
    {
        for (int j = 5; j < cardContainer.transform.childCount; j++)
        {
            int index = j - 5;
            //int index_1 = cardContainer.transform.childCount - 1 - j;
            GameObject    go = cardContainer.transform.GetChild(j).gameObject;
            TweenPosition tp = go.GetComponent <TweenPosition>();
            TweenRotation tr = go.GetComponent <TweenRotation>();
            if (go.transform.localPosition.y > 12.75f)
            {
                if (go.transform.localPosition.y < 13.0f)
                {
                    tp.enabled = true;
                    tp.from    = go.transform.localPosition;
                    tp.onFinished.Clear();
                    tp.delay    = 0.3f * index + 1f;
                    tp.duration = 0.5f;
                    tp.from     = go.transform.localPosition;
                    tp.to       = new Vector3(-7.7f + index * 4f, -1.5f, 11.8f);
                    tp.ResetToBeginning();


                    tr.enabled  = true;
                    tr.delay    = 0.3f * index + 1f;
                    tr.duration = 0.5f;
                    tr.onFinished.Clear();
                    tr.from = go.transform.rotation.eulerAngles;
                    tr.to   = new Vector3(0, 150, 0);
                    tr.ResetToBeginning();
                }
                if (go.transform.localPosition.y == 13.0f)
                {
                    tp.enabled = true;
                    tp.from    = go.transform.localPosition;
                    tp.onFinished.Clear();
                    tp.delay    = 0.3f * index + 1f;
                    tp.duration = 0.5f;
                    tp.from     = go.transform.localPosition;
                    tp.to       = new Vector3(-7.7f + index * 4f, -1.5f, 11.8f);
                    tp.ResetToBeginning();


                    tr.enabled  = true;
                    tr.delay    = 0.3f * index + 1f;
                    tr.duration = 0.5f;
                    tr.onFinished.Clear();
                    tr.from = go.transform.rotation.eulerAngles;
                    tr.to   = new Vector3(0, 180, 0);
                    tr.ResetToBeginning();
                }
                if (go.transform.localPosition.y > 13.0f)
                {
                    tp.enabled = true;
                    tp.from    = go.transform.localPosition;
                    tp.onFinished.Clear();
                    tp.delay    = 0.3f * index + 1f;
                    tp.duration = 0.5f;
                    tp.from     = go.transform.localPosition;
                    tp.to       = new Vector3(-7.7f + index * 4f, -1.5f, 11.8f);
                    tp.ResetToBeginning();


                    tr.enabled  = true;
                    tr.delay    = 0.3f * index + 1f;
                    tr.duration = 0.5f;
                    tr.onFinished.Clear();
                    tr.from = go.transform.rotation.eulerAngles;
                    tr.to   = new Vector3(0, -150, 0);
                    tr.ResetToBeginning();
                }
            }
            if (j >= cardContainer.transform.childCount - 1)
            {
                tp.onFinished.Add(new EventDelegate(OnFinshedMoveToScreen));
            }
        }
    }
Esempio n. 5
0
    void CardMoveToScreen()
    {
        if (isCardMoveToScreenOver)
        {
            return;
        }
        for (int i = 0; i < cardContainer.transform.childCount; i++)
        {
            // int index = i - 5;
            GameObject go = cardContainer.transform.GetChild(i).gameObject;
            // GameObject go = cardContainer.transform.GetChild(index).gameObject;
            TweenPosition tp = go.GetComponent <TweenPosition>();
            TweenRotation tr = go.GetComponent <TweenRotation>();
            if (go.transform.localPosition.y < 12.75f)
            {
                if (go.transform.localPosition.y < 12.5f)
                {
                    tp.enabled = true;
                    tp.from    = go.transform.localPosition;
                    tp.onFinished.Clear();
                    tp.delay    = 0.3f * i + 1f;
                    tp.duration = 0.5f;
                    tp.from     = go.transform.localPosition;
                    tp.to       = new Vector3(-7.7f + i * 4f, 3.7f, 11.8f);
                    tp.ResetToBeginning();


                    tr.enabled  = true;
                    tr.delay    = 0.3f * i + 1f;
                    tr.duration = 0.5f;
                    tr.onFinished.Clear();
                    tr.from = go.transform.rotation.eulerAngles;
                    tr.to   = new Vector3(0, 150, 0);
                    tr.ResetToBeginning();
                }
                if (go.transform.localPosition.y == 12.5f)
                {
                    tp.enabled = true;
                    tp.from    = go.transform.localPosition;
                    tp.onFinished.Clear();
                    tp.delay    = 0.3f * i + 1f;
                    tp.duration = 0.5f;
                    tp.from     = go.transform.localPosition;
                    tp.to       = new Vector3(-7.7f + i * 4f, 3.7f, 11.8f);

                    tp.ResetToBeginning();

                    tr.enabled  = true;
                    tr.delay    = 0.3f * i + 1f;
                    tr.duration = 0.5f;
                    tr.onFinished.Clear();
                    tr.from = go.transform.rotation.eulerAngles;
                    tr.to   = new Vector3(0, 180, 0);
                    tr.ResetToBeginning();
                }
                if (go.transform.localPosition.y > 12.5f)
                {
                    tp.enabled = true;
                    tp.from    = go.transform.localPosition;
                    tp.onFinished.Clear();
                    tp.delay    = 0.3f * i + 1f;
                    tp.duration = 0.5f;
                    tp.from     = go.transform.localPosition;
                    tp.to       = new Vector3(-7.7f + i * 4f, 3.7f, 11.8f);
                    tp.ResetToBeginning();


                    tr.enabled  = true;
                    tr.delay    = 0.3f * i + 1f;
                    tr.duration = 0.5f;
                    tr.onFinished.Clear();
                    tr.from = go.transform.rotation.eulerAngles;
                    tr.to   = new Vector3(0, -150, 0);
                    tr.ResetToBeginning();
                }
            }
            if (i >= cardContainer.transform.childCount - 6)
            {
                tp.onFinished.Add(new EventDelegate(CardMoveToScreen_2));
                break;
            }
        }
        isCardMoveToScreenOver = true;
    }
Esempio n. 6
0
    void InitSkillCard()
    {
        startBtn.gameObject.SetActive(false);
        cardContainer.gameObject.SetActive(true);

        for (int i = 0; i < cardContainer.transform.childCount; i++)
        {
            GameObject go = cardContainer.transform.GetChild(i).gameObject;

            if (i % 2 == 0)
            {
                go.transform.localPosition = new Vector3(-50, 35, 80);
                TweenPosition tp = go.GetComponent <TweenPosition>();
                tp.enabled = true;
                tp.from    = go.transform.localPosition;
                tp.onFinished.Clear();
                tp.delay    = i * 0.3f;
                tp.duration = 1.0f;
                tp.from     = go.transform.localPosition;
                tp.to       = new Vector3(5.5f, 12.3f + i * 0.1f, 80);
                tp.ResetToBeginning();

                TweenRotation tr = go.GetComponent <TweenRotation>();
                tr.enabled  = true;
                tr.delay    = i * 0.2f;
                tr.duration = 1.0f;
                tr.onFinished.Clear();
                tr.from = go.transform.rotation.eulerAngles;
                tr.to   = new Vector3(80, 0, 1.1722f);
                tr.ResetToBeginning();
            }
            if (i % 2 != 0)
            {
                go.transform.localPosition = new Vector3(50, 35, 80);
                TweenPosition tp = go.GetComponent <TweenPosition>();
                tp.enabled = true;
                tp.from    = go.transform.localPosition;
                tp.onFinished.Clear();
                tp.delay    = i * 0.3f;
                tp.duration = 1.0f;
                tp.from     = go.transform.localPosition;
                tp.to       = new Vector3(5.5f, 12.3f + i * 0.1f, 80);
                tp.ResetToBeginning();

                TweenRotation tr = go.GetComponent <TweenRotation>();
                tr.enabled  = true;
                tr.delay    = i * 0.2f;
                tr.duration = 1.0f;
                tr.onFinished.Clear();
                tr.from = go.transform.rotation.eulerAngles;
                tr.to   = new Vector3(80, 0, 1.1722f);
                tr.ResetToBeginning();
            }

            if (i >= cardContainer.transform.childCount - 1)
            {
                TweenPosition tp = go.GetComponent <TweenPosition>();
                tp.onFinished.Add(new EventDelegate(CardMoveToScreen));
            }
            else
            {
                TweenPosition tp = go.GetComponent <TweenPosition>();
                tp.onFinished.Add(new EventDelegate(PlayCardEffectMusic));
            }
        }
    }