Exemple #1
0
 public void AddNetworkData(ColonyNetwork colonyNetwork, int teamNum)
 {
     if (!ColonyData.ContainsKey(teamNum))
     {
         ColonyData.Add(teamNum, new List <ColonyNetwork>());
     }
     ColonyData[teamNum].Add(colonyNetwork);
 }
Exemple #2
0
 public void SetNetwork(ColonyNetwork network)
 {
     if (network == null)
     {
         return;
     }
     _Network = network;
     ColonyMgr.AddColonyItem(this);
 }
 public ColonyDwellings(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSDwellingsData();
     //_MyData = (CSDwellingsData)_RecordData;
     _Npcs = new int[4];
     for (int i = 0; i < _Npcs.Length; i++)
     {
         _Npcs[i] = 0;
     }
 }
 //CSTradeData _MyData;
 public ColonyTrade(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSTradeData();
     //_MyData = (CSTradeData)_RecordData;
 }
Exemple #5
0
 //CSFactoryData _MyData;
 public ColonyFactory(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSFactoryData();
     //_MyData = (CSFactoryData)_RecordData;
 }
Exemple #6
0
 //CSRepairData _MyData;
 public ColonyRepair(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSRepairData();
     //_MyData = (CSRepairData)_RecordData;
 }
Exemple #7
0
 public ColonyPPFusion(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSPPFusionData();
     _MyData     = (CSPPFusionData)_RecordData;
 }
 public ColonyPPCoal(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSPPCoalData();
     _MyData     = (CSPPCoalData)_RecordData;
 }
Exemple #9
0
 public ColonyPowerPlant(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSPowerPlanetData();
     _MyData     = (CSPowerPlanetData)_RecordData;
 }
Exemple #10
0
 //CSEnhanceData _MyData;
 public ColonyEnhance(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSEnhanceData();
     //_MyData = (CSEnhanceData)_RecordData;
 }
Exemple #11
0
    public void AddDataToCreator(ColonyNetwork colonyNetwork, int teamNum)
    {
        CSMgCreator creator;

        if (teamNum == BaseNetwork.MainPlayer.TeamId)
        {
            creator = CSMain.s_MgCreator;
        }
        else
        {
            creator = CSMain.Instance.MultiGetOtherCreator(teamNum) as CSMgCreator;
        }
        creator.teamNum = teamNum;
        CSObjectData objData = colonyNetwork._ColonyObj._RecordData as CSObjectData;

        if (objData != null
            //&& objData.ID != CSConst.etID_Farm//--to do:?
            )
        {
            //if (!objData.m_Alive)
            //    return;

            CSEntityAttr attr = new CSEntityAttr();
            attr.m_InstanceId = objData.ID;
            attr.m_Type       = objData.dType;
            attr.m_Pos        = objData.m_Position;
            attr.m_protoId    = objData.ItemID;
            attr.m_Bound      = objData.m_Bounds;
            attr.m_ColonyBase = colonyNetwork._ColonyObj;
            CSEntity cse = creator._createEntity(attr);
            colonyNetwork.m_Entity = cse;

            if (objData.dType == CSConst.dtAssembly)
            {
                CSAssembly csa = cse as CSAssembly;
                csa.ChangeState();
            }
            else
            {
                CSCommon csc = cse as CSCommon;
                if (creator.Assembly != null)
                {
                    creator.Assembly.AttachCommonEntity(csc);
                }


                if (cse as CSDwellings != null)
                {
                    cse._Net.RPCServer(EPacketType.PT_CL_DWL_SyncNpc);
                }

                foreach (CSPersonnel csp in creator.GetNpcs())
                {
                    if (csp.Data.m_WorkRoomID == attr.m_InstanceId && csp.WorkRoom != csc)
                    {
                        csp.WorkRoom = csc;
                    }
                }
            }
            //init worker



            creator.ExecuteEvent(CSConst.cetAddEntity, cse);
        }
    }
 //CSCheckData _MyData;
 public ColonyCheck(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSCheckData();
     //_MyData = (CSCheckData)_RecordData;
 }
 //CSProcessingData _MyData;
 public ColonyProcessing(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSProcessingData();
     //_MyData = (CSProcessingData)_RecordData;
 }
Exemple #14
0
    public override void OnConstruct()
    {
        base.OnConstruct();
        csbl = GetComponentInParent <CSBuildingLogic>();
        if (!GameConfig.IsMultiMode)
        {
            CSMgCreator creator = CSMain.s_MgCreator;
            if (creator != null)
            {
                CSEntityObject ceo = GetComponent <CSEntityObject>();
                int            r;
                if (csbl != null)
                {
                    r = ceo.Init(csbl, creator);
                }
                else
                {
                    r = ceo.Init(itemObjectId, creator);
                }

                if (r != CSConst.rrtSucceed)
                {
                    Debug.LogError("Error with Init Entities");
                }
                else
                {
                    if (ceo.m_Type == CSConst.ObjectType.Assembly)
                    {
                        CSMain.SinglePlayerCheckClod();

                        //--to do: attack
                        //ColonyRunner cr = gameObject.GetComponent<ColonyRunner>();
                        //if (cr != null)
                        //{
                        //    cr.DeathHandlerEvent += OnTowerDeath;
                        //}
                    }

//					SendMessage("OnPutGo", mItemObj.instanceId);
                }
            }

//		    SendMessage("OnCreatedGo", mItemObj.instanceId);
        }
        else
        {
            int buildingTeam;
            if (csbl != null)
            {
                buildingTeam = csbl.TeamId;
            }
            else
            {
                buildingTeam = mNetlayer.TeamId;
            }
            ;
            CSMgCreator creator;
            if (buildingTeam == BaseNetwork.MainPlayer.TeamId)
            {
                creator = CSMain.s_MgCreator;
            }
            else
            {
                creator = CSMain.Instance.MultiGetOtherCreator(buildingTeam) as CSMgCreator;
            }
            if (creator != null)
            {
                CSEntityObject ceo           = GetComponent <CSEntityObject>();
                ColonyNetwork  colonyNetwork = mNetlayer as ColonyNetwork;
                ceo._ColonyObj = colonyNetwork._ColonyObj;
                int r;
                if (csbl != null)
                {
                    r = ceo.Init(csbl, creator);
                }
                else
                {
                    r = ceo.Init(itemObjectId, creator);
                }

                if (r != CSConst.rrtSucceed)
                {
                    Debug.LogError("Error with Init Entities");
                    //				Debug.Break();
                }
                else
                {
                    if (ceo.m_Type == CSConst.ObjectType.Assembly)
                    {
                        CSMain.SinglePlayerCheckClod();

                        //--to do: attack
                        //ColonyRunner cr = gameObject.GetComponent<ColonyRunner>();
                        //if (cr != null)
                        //{
                        //    cr.DeathHandlerEvent += OnTowerDeath;
                        //}
                    }

                    //SendMessage("OnPutGo", mItemObj.instanceId);
                }
            }
            //SendMessage("OnCreatedGo", itemObj.instanceId);
        }
    }
Exemple #15
0
 //CSAssemblyData _MyData;
 public ColonyAssembly(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSAssemblyData();
     //_MyData = (CSAssemblyData)_RecordData;
 }
 //CSStorageData _MyData;
 public ColonyStorage(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSStorageData();
     //_MyData = (CSStorageData)_RecordData;
 }