Example #1
0
    public void RefreshPatientGrids(List <CSPersonnel> _patients)
    {
        if (CSUI_MainWndCtrl.Instance == null)
        {
            return;
        }

        int Len = 0;

        for (int i = 0; i < _patients.Count; ++i)
        {
            // Already has a CSUI_NPCGrid? just replace the npc reference!
            if (Len < m_PatientGrids.Count)
            {
                m_PatientGrids[Len].m_Npc = _patients[i];
            }
            else
            {
                CSUI_NpcGridItem npcGrid = _createNPCGird(_patients[i], m_Grid.transform);
                m_PatientGrids.Add(npcGrid);
            }
            Len++;
        }

        //Has redundant grid? just destroy it
        if (Len < m_PatientGrids.Count)
        {
            for (int i = Len; i < m_PatientGrids.Count;)
            {
                DestroyImmediate(m_PatientGrids[i].gameObject);
                m_PatientGrids.RemoveAt(i);
            }
        }
        m_Grid.repositionNow = true;
    }
Example #2
0
    private CSUI_NpcGridItem _createNPCGird(CSPersonnel npc, Transform root)
    {
        CSUI_NpcGridItem npcGrid = Instantiate(m_NpcGridPrefab) as CSUI_NpcGridItem;

        npcGrid.transform.parent = root;
        CSUtils.ResetLoacalTransform(npcGrid.transform);
        npcGrid.m_UseDeletebutton = false;
        npcGrid.m_Npc             = npc;
        //npcGrid.ShowNpcName();
        UICheckbox cb = npcGrid.gameObject.GetComponent <UICheckbox>();

        cb.radioButtonRoot = root;
        return(npcGrid);
    }