1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class MapSelectPanel : MonoBehaviour {
- public Text title;
- public Text description;
- public Image tipImg;
- public Text[] tipTxtArr;
- public Sprite[] tipImages;
- private int currentIndex;
- private MapData[] mapDataArr;
- public MainController mainController;
- // Use this for initialization
- void Start ()
- {
- // mapDataArr = MapData.GetMapDataArr();
- Show(0);
- }
- public void Prev()
- {
- Show(currentIndex - 1);
- }
- public void Next()
- {
- Show(currentIndex + 1);
- }
- public void Show(int index)
- {
- this.currentIndex = index;
- while(currentIndex < 0)
- {
- currentIndex += mapDataArr.Length;
- }
- while(currentIndex >= mapDataArr.Length)
- {
- currentIndex -= mapDataArr.Length;
- }
- MapData mapData = mapDataArr[currentIndex];
- title.text = mapData.name;
- description.text = Language.GetStr("MapInfo", "winCondition") + mapData.description;
- tipImg.sprite = tipImages[currentIndex];
- for(int i=0; i<tipTxtArr.Length; i++)
- {
- tipTxtArr[i].text = mapData.tips[i];
- }
- }
- public void StartLocalBattle()
- {
- mainController.StartLocalBattle (mapDataArr [currentIndex].id);
- }
- public void StartRemoteBattle()
- {
- mainController.StartRemoteBattle (mapDataArr [currentIndex].id, MapData.Mode.Normal);
- }
- // Update is called once per frame
- void Update ()
- {
-
- }
- }
|