Esempio n. 1
0
    CSUI_PlantGrid _createPlantGrid(FarmPlantLogic p)
    {
        CSUI_PlantGrid pg = Instantiate(m_PlantPart.m_PlantGridPrefab) as CSUI_PlantGrid;

        pg.transform.parent = m_PlantPart.m_Root.transform;
        CSUtils.ResetLoacalTransform(pg.transform);
        pg.m_Plant       = p;
        pg.OnDestroySelf = OnPlantGridDestroySelf;
        //ItemObject itemObj = ItemMgr.Instance.Get( pg.m_Plant.mInstanceId);
        //if (itemObj != null)
        //{
        string[] iconStr = ItemProto.Mgr.Instance.Get(pg.m_Plant.protoTypeId).icon;
        if (iconStr.Length != 0)
        {
            pg.IconSpriteName = iconStr[0];
        }
        else
        {
            pg.IconSpriteName = "";
        }
        //}
        m_PlantGrids.Add(pg);

        UICheckbox cb = pg.gameObject.GetComponent <UICheckbox>();

        cb.radioButtonRoot = m_PlantPart.m_Root.transform;
        cb.startsChecked   = false;

        return(pg);
    }
Esempio n. 2
0
    CSUI_Grid _createGrid(Transform parent, int index = -1)
    {
        CSUI_Grid grid = Instantiate(m_GridPrefab) as CSUI_Grid;

        grid.transform.parent = parent;
        CSUtils.ResetLoacalTransform(grid.transform);

        grid.m_Index = index;

        return(grid);
    }
Esempio n. 3
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);
    }
Esempio n. 4
0
    private CSUI_MyNpcItem CreateNPCGird(CSUIMyNpc npc, Transform root)//生成一个npc
    {
        CSUI_MyNpcItem npcGrid = Instantiate(m_NpcGridPrefab) as CSUI_MyNpcItem;

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

        cb.radioButtonRoot = root;
        UIEventListener.Get(npcGrid.gameObject).onActivate = OnNPCGridActive;
        return(npcGrid);
    }
Esempio n. 5
0
    void Awake()
    {
        m_HeroItems = new CSUI_HeroItem[2];
        for (int i = 0; i < m_HeroItems.Length; i++)
        {
            m_HeroItems[i] = Instantiate(HeroItemUIPrefab) as CSUI_HeroItem;
            m_HeroItems[i].transform.parent = m_HeroItemRootUI.transform;
            CSUtils.ResetLoacalTransform(m_HeroItems[i].transform);
            m_HeroItems[i].m_HeroIndex  = i;
            m_HeroItems[i].HandlePerson = m_RefNpc;
        }


        m_HeroItemRootUI.repositionNow = true;
    }
Esempio n. 6
0
    private CSUI_NPCGrid _createNPCGird(CSPersonnel npc, Transform root)
    {
        CSUI_NPCGrid npcGrid = Instantiate(m_NpcGridPrefab) as CSUI_NPCGrid;

        npcGrid.transform.parent = root;
        CSUtils.ResetLoacalTransform(npcGrid.transform);
        npcGrid.m_UseDeletebutton = true;
        npcGrid.OnDestroySelf     = OnNPCGridDestroySelf;

        npcGrid.m_Npc = npc;

        UICheckbox cb = npcGrid.gameObject.GetComponent <UICheckbox>();

        cb.radioButtonRoot = root;

        UIEventListener.Get(npcGrid.gameObject).onActivate = OnNPCGridActive;

        return(npcGrid);
    }
Esempio n. 7
0
    void AddNpcAbnormal(PEAbnormalType type)
    {
        AbnormalData data = AbnormalData.GetData(type);

        //lz-2016.08.26 异常状态是0的图标不显示
        if (null == data || data.iconName == "0")
        {
            return;
        }
        CSUI_BuffItem item = Instantiate(mAbnormalPrefab) as CSUI_BuffItem;

        if (!item.gameObject.activeSelf)
        {
            item.gameObject.SetActive(true);
        }
        item.transform.parent = mAbnormalGrid.transform;
        CSUtils.ResetLoacalTransform(item.transform);
        item.SetInfo(data.iconName, data.description);
        mAbnormalList.Add(item);
        mReposition = true;
    }
Esempio n. 8
0
    public void AddBuffShow(string _icon, string _describe) //添加一个buff图标
    {
        if (m_IconList.Contains(_icon))                     //如果已经有这种图标,就返回
        {
            m_IconList.Add(_icon);
            return;
        }
        else                          //如果没有,就生成
        {
            m_IconList.Add(_icon);
        }

        CSUI_BuffItem grid = Instantiate(m_BuffPrefab) as CSUI_BuffItem;

        if (!grid.gameObject.activeSelf)
        {
            grid.gameObject.SetActive(true);
        }
        grid.transform.parent = m_BuffGrid.transform;
        CSUtils.ResetLoacalTransform(grid.transform);
        grid.SetInfo(_icon, _describe);
        m_BuffList.Add(grid);
        m_Reposition = true;
    }