Exemplo n.º 1
0
        public static void DrawAndUpdate(RenderWindow window)
        {
            chooseModeNow = chooseMode.None;

            foreach (var level in levelSprites)
            {
                level.Value.Color = Color.White;
                if (level.Value.GetGlobalBounds().Contains((int)Program.LastMousePosition.X, (int)Program.LastMousePosition.Y))
                {
                    level.Value.Color = Color.Red;
                    chooseLevel       = level.Key;
                    chooseModeNow     = chooseMode.Level;
                }
            }

            cancelSprite.Color = Color.White;

            if (cancelSprite.GetGlobalBounds().Contains((int)Program.LastMousePosition.X, (int)Program.LastMousePosition.Y))
            {
                cancelSprite.Color = Color.Red;
                chooseLevel        = 0;
                chooseModeNow      = chooseMode.Cancel;
            }

            foreach (var level in levelSprites)
            {
                window.Draw(level.Value);
            }

            window.Draw(cancelSprite);
        }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        cm = GameObject.Find("GameManager").GetComponent <chooseMode>();
        LoadScore();

        //due to score is static so u should use class to use its function
        if (ScoreScript.Score >= 0)
        {
            while (myList.Count <= 8)
            {
                myList.Add(0);
            }
            // 清空排行榜
            ClearLayout();
            // 生成排行榜
            for (int i = 0; i < 8; i++)
            {
                instGameObj = (GameObject)Instantiate(PlayerScoreListPrefab);
                //SetParent(transform,false) the false can moderate the prefab scale instantiate on UI
                instGameObj.transform.SetParent(transform, false);
                instGameObj.transform.Find("RankText").GetComponent <Text> ().text = "No." + (i + 1);

                instGameObj.transform.Find("NameText").GetComponent <Text> ().text  = PlayerPrefs.GetString(cm.getPlayerSaveFileName);
                instGameObj.transform.Find("ScoreText").GetComponent <Text> ().text = myList [i].ToString();
                //print(PlayerPrefs.GetInt("ScoreScript.Score").ToString());
            }
        }
    }
Exemplo n.º 3
0
    //往左滑 = 往下一顆星球
    public void swipeBefore()
    {
        if (this.transform.GetChild(this.transform.childCount - 1).gameObject.activeSelf)
        {
            Debug.Log("已經到最左邊了");
            return; //在最左邊,不動作
        }
        else
        {
            this.transform.GetChild(currentChoice).gameObject.SetActive(false);                 //隱藏目前星球
            this.transform.GetChild(currentChoice + 1).gameObject.SetActive(true);              //下一個星球開啟
            currentChoice++;
            if (currentChoice == 0)
            {
                arrow.GetChild(1).gameObject.SetActive(false);
            }
            else if (currentChoice == 2)
            {
                arrow.GetChild(0).gameObject.SetActive(false);
            }
            else
            {
                arrow.GetChild(1).gameObject.SetActive(true);
            }

            // Refresh experience
            chooseMode cm = GameObject.Find("GameManager").GetComponent <chooseMode>();
            cm.GetExperience();
        }
    }
Exemplo n.º 4
0
    //往右滑 = 回上一顆星球
    public void swipeAfter()
    {
        if (this.transform.GetChild(0).gameObject.activeSelf)
        {
            Debug.Log("已經到最右邊了");
            return;             //在最右邊,不動作
        }
        else
        {
            this.transform.GetChild(currentChoice).gameObject.SetActive(false);                                 //目前隱藏
            this.transform.GetChild(currentChoice - 1).gameObject.SetActive(true);                              //前一個開啟
            currentChoice--;
            if (currentChoice == 0)
            {
                arrow.GetChild(0).gameObject.SetActive(true);
                arrow.GetChild(1).gameObject.SetActive(false);
            }
            else
            {
                arrow.GetChild(0).gameObject.SetActive(true);
            }

            // Refresh experience
            chooseMode cm = GameObject.Find("GameManager").GetComponent <chooseMode>();
            cm.GetExperience();
        }
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Awake()
    {
        cm = gameObject.GetComponent <chooseMode>();
        if (cm == null)
        {
            Debug.LogError("Unable to load chooseMode script");
        }

        //如果讀取前不存,會讀不到8筆
        //如果讀取前存檔,當有資料會覆寫過去
        if (!PlayerPrefs.HasKey("isFirstTime") || chooseMode.isGameLoaded)         // First time to excute the game
        {
            SaveScoreToSave();
            LoadScoreFromSave();
        }
        else
        {
            LoadScoreFromSave();
        }

        if (addScoreList.Count != 8)
        {
            Debug.LogError("Load Error");
        }
        if (subScoreList.Count != 8)
        {
            Debug.LogError("Load Error");
        }
        if (divScoreList.Count != 8)
        {
            Debug.LogError("Load Error");
        }
    }
Exemplo n.º 6
0
 // Awake會在這個GameObject一被activate時執行
 void Awake()
 {
     cm = GameObject.Find("GameManager").GetComponent <chooseMode>();
     if (cm == null)
     {
         Debug.LogError("Unable to load chooseMode script");
     }
 }