Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 3cb70579

Přidáno uživatelem Zuzana Káčereková před více než 3 roky(ů)

Added communication model and XML serialization

Zobrazit rozdíly:

Client/Client/Assets/Scripts/Model/Buildings.cs
4 4

  
5 5
public class Buildings : MonoBehaviour
6 6
{
7
    public string[] buildings;
7
    public static string[] buildings = new string[] { 
8
        "FST+FEK", "FDU", "FAV", "FEL", "REK", "MENZA", "LIB", "CIV", "UNI14", 
9
        "DOM", "HUS", "CHOD", "JUNG", "KLAT", "KOLL", "RIEG", "SADY", "SED+VEL", 
10
        "TES", "TYL", "KARMA", "KBORY", "KLOCH", "KKLAT" };
11

  
8 12

  
9 13
    // Start is called before the first frame update
10 14
    void Start()
11 15
    {
12
        TextAsset file = Resources.Load<TextAsset>("buildings");
13
        string[] split = file.ToString().Split('\n');
14
        List<string> buildingsTMP = new List<string>();
15

  
16
        foreach (string s in split)
17
        {
18
            string trimmed = s.Trim();
19
            if (trimmed.Length > 0)
20
                buildingsTMP.Add(trimmed);
21
        }
22

  
23
        buildings = buildingsTMP.ToArray();
16
        // TextAsset file = Resources.Load<TextAsset>("buildings");
17
        // string[] split = file.ToString().Split('\n');
18
        // List<string> buildingsTMP = new List<string>();
19
        // 
20
        // foreach (string s in split)
21
        // {
22
        //     string trimmed = s.Trim();
23
        //     if (trimmed.Length > 0)
24
        //         buildingsTMP.Add(trimmed);
25
        // }
26
        // 
27
        // buildings = buildingsTMP.ToArray();
24 28
    }
25 29
}

Také k dispozici: Unified diff