예제 #1
0
    private void UpdateCampCreate(int camp, GameObject copy)
    {
        AWBuildingBarrack      buildingBarrack  = AWCore.Instance.GetGame().GetScene <AWSceneHome>().GetAWBuilding <AWBuildingBarrack>(m_building);
        IBuildingConfItem      buildingConfItem = AW.GetSingleton <IDataAdapter>().GetBuildingConfItem(m_building);
        List <int>             produceUnitLists = AW.GetSingleton <IDataAdapter>().GetProduceUnitList(m_building.GetBuildingType());
        Dictionary <int, Camp> produceTroops    = barrack.GetProduceTroopDic();

        copy.transform.SetParent(campAnchor, false);
        copy.GetComponent <UISetAnchor>().SetAnchor(buildingBarrack.GetModelAnchor(camp), UIAnchorType.World3DToUI2D);
        UICampItem campItem = copy.GetComponent <UICampItem>();

        campItem.InitCamp(produceTroops, camp, buildingConfItem);
        campItem.SetUnitName();
        campItem.SetSelect(false);
        itemList.Add(campItem);
        Button button = copy.GetComponent <Button>();

        button.onClick.RemoveAllListeners();
        button.onClick.AddListener(CloseUnitList);
        button.onClick.AddListener(ResetCampItem);
        button.onClick.AddListener(new OnClickCampEvent(construction, troopsInfoAnchor, produceTroops[camp], replaceUnitList, produceUnitLists, m_building, replaceUnitListAnchor, campItem).OnClickCreateTroopsInfo);
        m_buildingProcess = copy.ExtGetMissingComponent <AWBuildingProcess>();
        m_buildingProcess.InitProcess(produceTroops[camp], copy.transform, new Vector3(-20, 80, 0), UIAnchorType.UI2DToUI2D);
        m_buildingProcess.SetShow(true);
    }
예제 #2
0
 public OnClickCampEvent(Button construction, Transform troopsAnchor, Camp camp, UIReplaceUnitList unitList, List <int> produceUnitList, Building building, Transform listAnchor, UICampItem campItem)
 {
     m_construction    = construction;
     m_troopsAnchor    = troopsAnchor;
     m_unitListAnchor  = listAnchor;
     m_camp            = camp;
     m_produceUnitList = produceUnitList;
     m_unitList        = unitList;
     m_building        = building;
     m_campItem        = campItem;
 }