Beispiel #1
0
// Member Functions


    // Public:


    public void Initialize(string _sServerName, string _sHostUsername)
    {
        //Debug.Log("Creating game....");
        m_sName = _sServerName;


        RegisterWithMasterServer(_sHostUsername);


        m_atSlots = new TSlot[(int)ESettings.CONNECTIONS_MAX + 1];
    }
Beispiel #2
0
    public void SetInfo(MeiShi newWord)
    {
        Debug.Log(newWord);
        //Clean the GUI for the word
        for (int i = 0; i < Slots.Count; i++)
        {
            Destroy(Slots[i].gameObject);
        }
        Slots.Clear();
        for (int i = 0; i < KanjiChoices.Count; i++)
        {
            Destroy(KanjiChoices[i].gameObject);
        }
        KanjiChoices.Clear();
        WordImage.gameObject.SetActive(false);
        WordText.text = "";
        //Set it for the new word
        if (MeishiData != null)
        {
            previousId = MeishiData.ID;
        }
        MeishiData = newWord;
        float StartingPosition = HintPart.rect.width / (MeishiData.Syllables.Count * 2);
        float StepWidth        = HintPart.rect.width / MeishiData.Syllables.Count;
        Slot  TSlot;

        for (int i = 0; i < MeishiData.Syllables.Count; i++)
        {
            TSlot = Instantiate(slotPrefab, Vector3.zero, HintPart.rotation, HintPart);
            TSlot.rectT.anchoredPosition = new Vector3(StartingPosition + StepWidth * i, SlotY, 0.0f);
            TSlot.SetInfo(MeishiData.Syllables[i], MeishiData.KanjiIDs[i]);
            Slots.Add(TSlot);
        }
        KanjiChoice  TKanji;
        List <Kanji> TListK = new List <Kanji>();

        foreach (string KID in MeishiData.KanjiIDs)
        {
            TListK.Add(GameController.instance.GetKanji(KID));
        }
        TListK = ShuffleKanjiList(TListK);
        for (int i = 0; i < TListK.Count; i++)
        {
            TKanji = Instantiate(kanjiPrefab, Vector3.zero, KanjiPart.rotation, KanjiPart);
            TKanji.rectTransform.anchoredPosition = new Vector3(StartingPosition + StepWidth * i, KanjiY, 0.0f);
            TKanji.SetInfo(TListK[i]);
            KanjiChoices.Add(TKanji);
        }
    }
Beispiel #3
0
 private void DestroySlotDefault(TSlot slot)
 {
     GameObject.Destroy(slot.gameObject);
 }