public void OpenWnd(CSPowerPlantObject powerPlantSolor) { //lz-2016.11.09 Cursh bug 错误 #5603 if (null == powerPlantSolor || null == powerPlantSolor.m_Entity) { Debug.LogError("powerPlantSolor is null."); return; } mPowerPlantSolor = powerPlantSolor; PeEntity entity = powerPlantSolor.GetComponentInParent <PeEntity>(); if (null != entity) { mMachinePos = entity.transform.position; } Show(); //多人模式 if (Pathea.PeGameMgr.IsMulti) { _net = MapObjNetwork.GetNet(mPowerPlantSolor.m_Entity.ID); if (_net != null) { _net.RequestItemList(); } else { Debug.LogError("can't find net id = " + mPowerPlantSolor.m_Entity.ID); } return; } if (null != mPowerPlantSolor.m_PowerPlant && mPowerPlantSolor.m_PowerPlant.GetChargingItemsCnt() > 0) { for (int i = 0; i < mPowerPlantSolor.m_PowerPlant.GetChargingItemsCnt(); i++) { ItemObject itemObject = mPowerPlantSolor.m_PowerPlant.GetChargingItem(i); if (i >= mChargingItemUi.Length) { Debug.LogError("too many charing item to show on solar ui"); break; } mChargingItemUi[i].SetItem(itemObject); } } }
public override bool Init(int id) { if (!base.Init(id)) { return(false); } if (CSMain.GetCreator(CSConst.ciDefNoMgCamp) == null) { CSMain.InitOperatItemEvent += PostInit; return(true); } else { CSPowerPlantObject ppo = GetComponent <CSPowerPlantObject>(); return(CSConst.rrtSucceed == ppo.Init(id, CSMain.GetCreator(CSConst.ciDefNoMgCamp), false)); } }
public void PostInit() { CSPowerPlantObject ppo = GetComponent <CSPowerPlantObject>(); ppo.Init(m_id, CSMain.GetCreator(CSConst.ciDefNoMgCamp), false); }