Ejemplo n.º 1
0
 private void Awake()
 {
     //Enemy Jinkei Load
     PvPDataStore = GameObject.Find("PvPDataStore").GetComponent <PvPDataStore>();
 }
Ejemplo n.º 2
0
    public void ShowKassen()
    {
        /*Common*/
        myUserId = PlayerPrefs.GetString("userId");


        //Hyourou
        int hyourou = PlayerPrefs.GetInt("hyourou");

        GameObject.Find("HyourouCurrentValue").GetComponent <Text>().text = hyourou.ToString();

        //Tama
        int busyoDama = PlayerPrefs.GetInt("busyoDama");

        GameObject.Find("BusyoDamaValue").GetComponent <Text>().text = busyoDama.ToString();


        /*LeftView*/
        LeftView = GameObject.Find("LeftView").gameObject;
        //Name
        myUserName = PlayerPrefs.GetString("PvPName");
        LeftView.transform.FindChild("myName").GetComponent <Text>().text = myUserName;

        //KuniLv
        kuniLv = PlayerPrefs.GetInt("kuniLv");
        LeftView.transform.FindChild("KuniLv").transform.FindChild("KuniLvValue").GetComponent <Text>().text = kuniLv.ToString();

        //Kamon & Busyo Image
        int    myDaimyo  = PlayerPrefs.GetInt("myDaimyo");
        string imagePath = "Prefabs/Kamon/" + myDaimyo.ToString();

        LeftView.transform.FindChild("Kamon").GetComponent <Image>().sprite =
            Resources.Load(imagePath, typeof(Sprite)) as Sprite;

        int    jinkei    = PlayerPrefs.GetInt("jinkei");
        string soudaisyo = "soudaisyo" + jinkei.ToString();

        soudaisyoBusyoId = PlayerPrefs.GetInt(soudaisyo);
        string imagePath2 = "Prefabs/Player/Sprite/unit" + soudaisyoBusyoId.ToString();

        LeftView.transform.FindChild("Soudaisyo").GetComponent <Image>().sprite =
            Resources.Load(imagePath2, typeof(Sprite)) as Sprite;

        //HP
        myJinkeiHeiryoku = PlayerPrefs.GetInt("pvpHeiryoku");
        if (myJinkeiHeiryoku == 0)
        {
            myJinkeiHeiryoku = PlayerPrefs.GetInt("jinkeiHeiryoku");
            PlayerPrefs.SetInt("pvpHeiryoku", myJinkeiHeiryoku);
            PlayerPrefs.Flush();
        }
        //myJinkeiHeiryoku = 1000000;
        LeftView.transform.FindChild("HP").transform.FindChild("hpValue").GetComponent <Text>().text = myJinkeiHeiryoku.ToString();


        //NCMB Data
        PvPDataStore    = GameObject.Find("PvPDataStore").GetComponent <PvPDataStore>();
        isHPFetched     = false;
        isMyPvPFetched  = false;
        isAtkDfcFetched = false;
        isShowed        = false;

        //1 time run
        PvPDataStore.GetPvPCount();

        //PvP
        List <float> perList = new List <float>()
        {
            0.7f, 0.8f, 0.9f, 1.0f, 1.2f, 1.4f, 1.6f, 1.8f
        };
        int rdmId = UnityEngine.Random.Range(0, perList.Count);

        per    = perList[rdmId];
        HpBase = Mathf.CeilToInt((float)myJinkeiHeiryoku * per);

        //PvP Top3 Ranking
        PvPDataStore.GetTop10Win();
        PvPDataStore.GetTop10HP();

        //Timer
        PvPTimerScript = GameObject.Find("Timer").GetComponent <PvPTimer>();
    }
Ejemplo n.º 3
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();
        audioSources[0].Play();

        //Check Network Ready
        if (name == "Rank")
        {
            PvPDataStore PvPDataStore = GameObject.Find("PvPDataStore").GetComponent <PvPDataStore>();

            if (PvPDataStore.Top3HPQtyList.Count > 0 && PvPDataStore.winRank > 0)
            {
                isReadyFlg = true;
            }
        }
        else if (name == "RankWeekly")
        {
            PvPDataStore PvPDataStore = GameObject.Find("PvPDataStore").GetComponent <PvPDataStore>();
            if (PvPDataStore.Top10PtWeeklyBusyoList.Count > 0 && PvPDataStore.ptRankWeekly > 0)
            {
                isReadyFlg = true;
            }
        }
        else
        {
            isReadyFlg = true;
        }

        if (isReadyFlg)
        {
            if (!clicked)
            {
                //Teb Changer
                Color pushedTabColor  = new Color(118f / 255f, 103f / 255f, 16f / 255f, 255f / 255f);
                Color pushedTextColor = new Color(219f / 255f, 219f / 255f, 212f / 255f, 255f / 255f);
                Color normalTabColor  = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
                Color normalTextColor = new Color(255f / 255f, 255f / 255f, 0f / 255f, 255f / 255f);

                GameObject UpperView = GameObject.Find("UpperView").gameObject;
                foreach (Transform obj in UpperView.transform)
                {
                    obj.GetComponent <Image>().color = normalTabColor;
                    obj.transform.FindChild("Text").GetComponent <Text>().color = normalTextColor;
                    obj.GetComponent <PvPTabHandler>().clicked = false;
                }
                GetComponent <Image>().color = pushedTabColor;
                transform.FindChild("Text").GetComponent <Text>().color = pushedTextColor;
                clicked = true;

                if (name == "Kassen")
                {
                    kassenViewObj.SetActive(true);
                    rankViewObj.SetActive(false);
                    rankWeeklyViewObj.SetActive(false);
                }
                else if (name == "Rank")
                {
                    kassenViewObj.SetActive(false);
                    rankWeeklyViewObj.SetActive(false);
                    rankViewObj.SetActive(true);

                    GameObject.Find("GameScene").GetComponent <PvPController>().ShowRank(rankViewObj);
                }
                else if (name == "RankWeekly")
                {
                    kassenViewObj.SetActive(false);
                    rankViewObj.SetActive(false);
                    rankWeeklyViewObj.SetActive(true);

                    GameObject.Find("GameScene").GetComponent <PvPController>().ShowRankWeekly(rankWeeklyViewObj);
                }
            }
        }
        else
        {
            Message msg = new Message();
            msg.makeMessage(msg.getMessage(143));
        }
    }
Ejemplo n.º 4
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();
        if (textScript.text == "")
        {
            audioSources[4].Play();
            Message msg = new Message();
            if (!secondTimeFlg)
            {
                msg.makeMessage(msg.getMessage(140));
            }
            else
            {
                msg.makeMessage(msg.getMessage(142));
            }
        }
        else
        {
            //Text Registeration
            audioSources[5].Play();
            DataPvP pvpScript = new DataPvP();

            if (!secondTimeFlg)
            {
                //Init Data Registration
                string userId   = PlayerPrefs.GetString("userId");
                string userName = textScript.text;
                pvpScript.InsertPvP(userId, userName);

                PlayerPrefs.SetString("PvPName", userName);
                PlayerPrefs.Flush();

                //Scene Change
                Application.LoadLevel("pvp");
            }
            else
            {
                //Second Time
                string userId   = PlayerPrefs.GetString("userId");
                string userName = textScript.text;
                pvpScript.UpdatePvPName(userId, userName);

                PlayerPrefs.SetString("PvPName", userName);
                PlayerPrefs.Flush();

                GameObject.Find("GameScene").GetComponent <PvPController>().myUserName = userName;

                GameObject.Find("myName").GetComponent <Text>().text = userName;
                touchBackObj.GetComponent <CloseOneBoard>().OnClick();

                //Change Rank
                PvPDataStore PvPDataStoreScript = GameObject.Find("PvPDataStore").GetComponent <PvPDataStore>();
                for (int i = 0; i < PvPDataStoreScript.Top10PtWeeklyUserIdList.Count; i++)
                {
                    if (userId == PvPDataStoreScript.Top10PtWeeklyUserIdList[i])
                    {
                        PvPDataStoreScript.Top10PtWeeklyNameList[i] = userName;
                    }
                }
                for (int j = 0; j < PvPDataStoreScript.Top3WinUserIdList.Count; j++)
                {
                    if (userId == PvPDataStoreScript.Top3WinUserIdList[j])
                    {
                        PvPDataStoreScript.Top3WinNameList[j] = userName;
                    }
                }
                for (int k = 0; k < PvPDataStoreScript.Top3HPUserIdList.Count; k++)
                {
                    if (userId == PvPDataStoreScript.Top3HPUserIdList[k])
                    {
                        PvPDataStoreScript.Top3HPNameList[k] = userName;
                    }
                }
            }
        }
    }