Пример #1
0
    protected override void OnPEInstantiate(uLink.NetworkMessageInfo info)
    {
        _id      = info.networkView.initialData.Read <int>();
        _teamId  = info.networkView.initialData.Read <int>();
        _ownerId = info.networkView.initialData.Read <int>();
        /*_externId = */ info.networkView.initialData.Read <int>();

        gameObject.name = "netflag_" + Id;

        _pos = transform.position;
        PlayerNetwork.OnLimitBoundsAdd(Id, new Bounds(_pos, new Vector3(128, 128, 128)));
    }
Пример #2
0
    protected override void OnPEInstantiate(uLink.NetworkMessageInfo info)
    {
        _id       = info.networkView.initialData.Read <int>();
        _externId = info.networkView.initialData.Read <int>();
        _ownerId  = info.networkView.initialData.Read <int>();
        _teamId   = info.networkView.initialData.Read <int>();

        _pos = transform.position;

        //prepare the data
        switch (ExternId)
        {
        case ColonyIDInfo.COLONY_ASSEMBLY:
        {
            PlayerNetwork.OnTeamChangedEventHandler += OnTeamChange;
            PlayerNetwork.OnLimitBoundsAdd(Id, new Bounds(_pos, new Vector3(128, 128, 128)));
            _ColonyObj = new ColonyAssembly(this);
            RPCServer(EPacketType.PT_CL_InitDataAssembly);
        }
        break;

        case ColonyIDInfo.COLONY_PPCOAL:
        {
            _ColonyObj = new ColonyPPCoal(this);
            RPCServer(EPacketType.PT_CL_InitDataPPCoal);
        }
        break;

        case ColonyIDInfo.COLONY_STORAGE:
        {
            _ColonyObj = new ColonyStorage(this);
            RPCServer(EPacketType.PT_CL_InitDataStorage);
        }
        break;

        case ColonyIDInfo.COLONY_REPAIR:
        {
            _ColonyObj = new ColonyRepair(this);
            RPCServer(EPacketType.PT_CL_InitDataRepair);
        }
        break;

        case ColonyIDInfo.COLONY_DWELLINGS:
        {
            _ColonyObj = new ColonyDwellings(this);
            RPCServer(EPacketType.PT_CL_InitDataDwellings);
        }
        break;

        case ColonyIDInfo.COLONY_ENHANCE:
        {
            _ColonyObj = new ColonyEnhance(this);
            RPCServer(EPacketType.PT_CL_InitDataEnhance);
        }
        break;

        case ColonyIDInfo.COLONY_RECYCLE:
        {
            _ColonyObj = new ColonyRecycle(this);
            RPCServer(EPacketType.PT_CL_InitDataRecycle);
        }
        break;

        case ColonyIDInfo.COLONY_FARM:
        {
            _ColonyObj = new ColonyFarm(this);
            RPCServer(EPacketType.PT_CL_InitDataFarm);
        }
        break;

        case ColonyIDInfo.COLONY_FACTORY:
        {
            _ColonyObj = new ColonyFactory(this);
            RPCServer(EPacketType.PT_CL_InitDataFactory);
        }
        break;

        case ColonyIDInfo.COLONY_PROCESSING:
        {
            _ColonyObj = new ColonyProcessing(this);
            RPCServer(EPacketType.PT_CL_InitDataProcessing);
        }
        break;

        case ColonyIDInfo.COLONY_TRADE:
        {
            _ColonyObj = new ColonyTrade(this);
            RPCServer(EPacketType.PT_CL_InitDataTrade);
        }
        break;

        case ColonyIDInfo.COLONY_CHECK:
        {
            _ColonyObj = new ColonyCheck(this);
            RPCServer(EPacketType.PT_CL_InitDataCheck);
        }
        break;

        case ColonyIDInfo.COLONY_TREAT:
        {
            _ColonyObj = new ColonyTreat(this);
            RPCServer(EPacketType.PT_CL_InitDataTreat);
        }
        break;

        case ColonyIDInfo.COLONY_TENT:
        {
            _ColonyObj = new ColonyTent(this);
            RPCServer(EPacketType.PT_CL_InitDataTent);
        }
        break;

        case ColonyIDInfo.COLONY_TRAIN:
        {
            _ColonyObj = new ColonyTrain(this);
            RPCServer(EPacketType.PT_CL_InitDataTrain);
        }
        break;

        case ColonyIDInfo.COLONY_FUSION:
        {
            _ColonyObj = new ColonyPPFusion(this);
            RPCServer(EPacketType.PT_CL_InitDataPPCoal);
        }
        break;

        default:
            Debug.LogError("ColonySystem itemid is wrong id = " + ExternId);
            break;
        }

        RPCServer(EPacketType.PT_CL_InitData);
    }