Ejemplo n.º 1
0
    void RPC_L2C_CloseServer(uLink.BitStream stream, LobbyMessageInfo info)
    {
        string msg = stream.Read <string>();

        MessageBox_N.CancelMask(MsgInfoType.ServerDeleteMask);
        MessageBox_N.ShowOkBox(msg);
    }
Ejemplo n.º 2
0
    void RPC_S2C_DWL_SyncNpc(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int[] npcs = stream.Read <int[]>();

        foreach (int npcId in npcs)
        {
            if (npcId != 0)
            {
                CSDwellings dwl = m_Entity as CSDwellings;
                CSPersonnel csNpc;
                //-- to do:
                CSMgCreator creator = MultiColonyManager.GetCreator(TeamId, false);
                if (creator != null)
                {
                    csNpc = creator.GetNpc(npcId);
                    if (csNpc != null && csNpc.Dwellings != null)
                    {
                        csNpc.Dwellings.RemoveNpc(csNpc);
                    }
                    if (csNpc != null && dwl != null)
                    {
                        dwl.AddNpcs(csNpc);
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    public void ConnectToServer()
    {
        IEnumerable <ServerInfo> servers = ServerRegistry.GetServers();

        foreach (ServerInfo server in servers)
        {
            uLink.BitStream dataCopy = server.data;
            //int numPlayers = dataCopy.ReadInt32();
            //int maxPlayers = dataCopy.ReadInt32();
            string name = dataCopy.ReadString();

            if (serverName == name)
            {
                attempts = 0;
                Debug.Log("CONNECTING TO SERVER" + server.host + " " + server.port);
                ConnectToIp(server.host, server.port);
            }
        }

        if (!uLink.Network.isServer && !uLink.Network.isClient)
        {
            if (attempts < 3)
            {
                attempts++;
                Invoke("ConnectToServer", 3);
            }
            else
            {
                attempts = 0;
                windowServerCreation.GetComponent <Menu>().errorDialogText.color = Color.red;
                windowServerCreation.GetComponent <Menu>().errorDialogText.text  = "Error creating a custom match";
                mainMenuManager.loadingScreenObj.SetActive(false);
            }
        }
    }
Ejemplo n.º 4
0
 public static object Deserialize(uLink.BitStream stream, params object[] codecOptions)
 {
     try
     {
         IntVector2        pos  = new IntVector2(stream.ReadInt32(), stream.ReadInt32());
         TownTradeItemInfo ttii = new TownTradeItemInfo(pos);
         ttii.csti      = CSTradeInfoData.GetData(stream.ReadInt32());
         ttii.m_CurTime = stream.ReadSingle();
         ttii.m_Time    = stream.ReadSingle();
         int needItemsCount = stream.ReadInt32();
         for (int m = 0; m < needItemsCount; m++)
         {
             ttii.needItems.Add((TradeObj)TradeObj.Deserialize(stream));
         }
         int rewardItemsCount = stream.ReadInt32();
         for (int m = 0; m < rewardItemsCount; m++)
         {
             ttii.rewardItems.Add((TradeObj)TradeObj.Deserialize(stream));
         }
         return(ttii);
     }
     catch (System.Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 5
0
 public static void Serialize(uLink.BitStream stream, object value, params object[] codecOptions)
 {
     try
     {
         TownTradeItemInfo ttii = value as TownTradeItemInfo;
         stream.WriteInt32(ttii.pos.x);
         stream.WriteInt32(ttii.pos.y);
         stream.WriteInt32(ttii.csti.id);
         stream.WriteSingle(ttii.m_CurTime);
         stream.WriteSingle(ttii.m_Time);
         stream.WriteInt32(ttii.needItems.Count);
         foreach (TradeObj to in ttii.needItems)
         {
             TradeObj.Serialize(stream, to);
         }
         stream.WriteInt32(ttii.rewardItems.Count);
         foreach (TradeObj to in ttii.rewardItems)
         {
             TradeObj.Serialize(stream, to);
         }
     }
     catch (System.Exception e)
     {
         throw e;
     }
 }
    void RPC_S2C_RequestAdMissionData(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        Vector3 pos = stream.Read <Vector3>();
        int     id  = stream.Read <int>();

        RandomDungenMgr.Instance.GenTaskEntrance(new IntVector2((int)pos.x, (int)pos.z), id);
    }
Ejemplo n.º 7
0
    protected void RPC_LobbyMsg(BitStream stream, LobbyMessageInfo info)
    {
        ELobbyMsgType msgType = ELobbyMsgType.Max;

        try
        {
            msgType = stream.Read <ELobbyMsgType>();

            if (CheckHandler(msgType))
            {
                msgHandlers[msgType](stream, info);
            }
            else
            if (LogFilter.logError)
            {
                Debug.LogWarningFormat("Message:[{0}]|[{1}] does not implement", msgType, GetType());
            }
        }
        catch (Exception e)
        {
            if (LogFilter.logError)
            {
                Debug.LogErrorFormat("Message:[{0}]\r\n{1}\r\n{2}\r\n{3}", GetType(), msgType, e.Message, e.StackTrace);
            }
        }
    }
    void RPC_S2C_CreateKillMonsterPos(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        Vector3 pos;
        float   radius;

        int[] idlist;
        int[] numlist;

        stream.TryRead <Vector3> (out pos);
        stream.TryRead <float> (out radius);
        stream.TryRead <int[]> (out idlist);
        stream.TryRead <int[]> (out numlist);

        List <Vector3> vcPosList = new List <Vector3> ();

        //Vector3 cpos;
        for (int i = 0; i < numlist.Length; i++)
        {
            for (int j = 0; j < numlist[i]; j++)
            {
                //cpos = SPMission.CreatePos(pos, radius, idlist[i]);
                //vcPosList.Add(cpos);
            }
        }

        Vector3[] poss = vcPosList.ToArray();

        if (null != PlayerNetwork.mainPlayer)
        {
            PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_MissionMonsterPos, poss, idlist, numlist);
        }
    }
    void RPC_S2C_MissionKillMonster(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int missionId = stream.Read <int> ();
        int targetId  = stream.Read <int> ();

        SceneEntityCreator.self.AddMissionPoint(missionId, targetId);
    }
Ejemplo n.º 10
0
    //添加任务
    void RPC_S2C_AccessMission(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int  nMissionID = stream.Read <int> ();
        int  nNpcID     = stream.Read <int> ();
        bool bCheck     = stream.Read <bool>();

        if (MissionManager.Instance.m_bHadInitMission)
        {
            if (!IsOwner)
            {
                byte[] adrmData = stream.Read <byte[]> ();
                AccessMission(nMissionID, nNpcID, bCheck, adrmData);
            }
            else
            {
                AccessMission(nMissionID, nNpcID, bCheck);
            }
        }
        else
        {
            if (!IsOwner)
            {
                byte[] adrmData = stream.Read <byte[]> ();
                string cmd      = "AccessMission@" + nMissionID.ToString() + "@" + nNpcID.ToString() + "@" + System.Text.Encoding.Default.GetString(adrmData) + "@";
                mainPlayer._commandCache.Add(cmd);
            }
            else
            {
                string cmd = "AccessMission@" + nMissionID.ToString() + "@" + nNpcID.ToString() + "@";
                mainPlayer._commandCache.Add(cmd);
            }
        }
    }
Ejemplo n.º 11
0
    //同步任务
    void RPC_S2C_SyncMissions(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        byte[] pmData     = stream.Read <byte[]> ();
        byte[] adrmData   = stream.Read <byte[]> ();
        byte[] tmData     = stream.Read <byte[]>();
        byte[] tmadrmData = stream.Read <byte[]>();

        if (PeGameMgr.IsMultiStory)
        {
            if (adrmData != null)
            {
                RMRepository.Import(adrmData);
            }
            if (tmadrmData != null)
            {
                RMRepository.Import(tmadrmData);
            }
        }
        else
        {
            if (adrmData != null)
            {
                AdRMRepository.Import(adrmData);
            }
            if (tmadrmData != null)
            {
                AdRMRepository.Import(tmadrmData);
            }
        }
        StartCoroutine(WaitForMissionModule(pmData, tmData));
    }
Ejemplo n.º 12
0
    //[Obsolete]
    void RPC_S2C_PutItem(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int        id    = stream.Read <int>();
        Vector3    pos   = stream.Read <Vector3>();
        Vector3    scale = stream.Read <Vector3>();
        Quaternion rot   = stream.Read <Quaternion>();

        ItemObject item = ItemMgr.Instance.Get(id);

        if (null == item)
        {
            return;
        }

        Drag drag = item.GetCmpt <Drag>();

        if (null == drag)
        {
            return;
        }

//         if (item.protoId == 1339)
//             KillNPC.ashBox_inScene++;


        /*DragArticleAgent dragItem = */ DragArticleAgent.Create(drag, pos, scale, rot, id);
    }
Ejemplo n.º 13
0
    void RPC_S2C_ExchangeItem(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int id        = stream.Read <int>();
        int destIndex = stream.Read <int>();
        int destId    = stream.Read <int>();
        int srcIndex  = stream.Read <int>();

        Pathea.PlayerPackageCmpt pkg = entity.GetCmpt <Pathea.PlayerPackageCmpt>();
        if (null == pkg)
        {
            return;
        }

        ItemObject item = ItemMgr.Instance.Get(id);

        if (null == item)
        {
            return;
        }

        if (-1 == destId)
        {
            pkg.Remove(item);
        }
        else
        {
            ItemObject destItem = ItemMgr.Instance.Get(destId);
            if (null != destItem)
            {
                pkg.package.PutItem(destItem, srcIndex, (ItemPackage.ESlotType)item.protoData.tabIndex);
            }
        }

        pkg.package.PutItem(item, destIndex, (ItemPackage.ESlotType)item.protoData.tabIndex);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 删除背包中的物品
    /// </summary>
    /// <param name="stream"></param>
    void RPC_S2C_DeleteItemInPackage(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int _objId;

        stream.TryRead <int>(out _objId);

        ItemObject obj = ItemMgr.Instance.Get(_objId);

        if (null == obj)
        {
            return;
        }

        Pathea.PlayerPackageCmpt pkg = entity.GetCmpt <Pathea.PlayerPackageCmpt>();
        if (null != pkg)
        {
            pkg.Remove(obj);
        }

        if (IsOwner)
        {
            GameUI.Instance.mItemPackageCtrl.ResetItem();
            //MainMidGui_N.Instance.UpdateLink();
        }

        //  if (null != PlayerFactory.mMainPlayer && null != PlayerFactory.mMainPlayer.m_PlayerMission)
        //   PlayerFactory.mMainPlayer.m_PlayerMission.CheckItemMissionList(nItemID);
    }
Ejemplo n.º 15
0
    void RPC_S2C_NewItemList(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        ItemSample[] newItems = stream.Read <ItemSample[]>();

        if (null == newItems || newItems.Length <= 0)
        {
            return;
        }

        foreach (ItemSample item in newItems)
        {
            if (null == item)
            {
                continue;
            }

            if (null != MissionManager.Instance)
            {
                MissionManager.Instance.ProcessCollectMissionByID(item.protoId);
            }
//			GlobalShowGui_N.Instance.AddShow(item);

            ItemProto protoData = ItemProto.Mgr.Instance.Get(item.protoId);
            if (protoData == null)
            {
                continue;
            }

            string msg = protoData.GetName() + " X " + item.stackCount.ToString();
            /*PeTipMsg tips = */ new PeTipMsg(msg, protoData.icon[0], PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Misc);
        }
    }
Ejemplo n.º 16
0
    public static object Deserialize(BitStream stream, params object[] args)
    {
        PlayerPersistantInfo ppi = new PlayerPersistantInfo();

        ppi.Read(stream);
        return(ppi);
    }
Ejemplo n.º 17
0
    void RPC_L2C_RoleLoggedIn(uLink.BitStream stream, LobbyMessageInfo info)
    {
        RoleInfoProxy role = stream.Read <RoleInfoProxy>();

        m_RolesInLobby.RemoveAll(iter => iter.steamId == role.steamId);
        m_RolesInLobby.Add(role);
    }
Ejemplo n.º 18
0
    void RPC_L2C_CreateRoleFailed(uLink.BitStream stream, LobbyMessageInfo info)
    {
        int _error;

        stream.TryRead <int>(out _error);
        if (_error == 1)//name used
        {
            MessageBox_N.ShowOkBox(PELocalization.GetString(ErrorMessage.NAME_HAS_EXISTED));
        }
        else if (_error == 2)//something must be wrong
        {
            RoleInfo[] _myRoles;
            stream.TryRead <RoleInfo[]>(out _myRoles);
            myRoles        = new List <RoleInfo>();
            myRolesExisted = new List <RoleInfo>();
            myRolesDeleted = new List <RoleInfo>();
            myRoles.AddRange(_myRoles);
            for (int m = 0; m < myRoles.Count; m++)
            {
                if (myRoles[m].deletedFlag != 1 && myRolesExisted.Count <= 3)
                {
                    myRolesExisted.Add(myRoles[m]);
                }
                else
                {
                    myRolesDeleted.Add(myRoles[m]);
                }
            }
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000496), PeSceneCtrl.Instance.GotoMultiRoleScene);
        }
        Debug.Log("Create Role Failed");
    }
Ejemplo n.º 19
0
    void RPC_S2C_FARM_SetAutoPlanting(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        CSFarmData reocrdData = (CSFarmData)_ColonyObj._RecordData;
        bool       bActive    = stream.Read <bool> ();

        reocrdData.m_AutoPlanting = bActive;
    }
Ejemplo n.º 20
0
    protected void RPC_S2C_ResponseInitData(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        if (hasOwnerAuth || null == PlayerNetwork.mainPlayer || isStart)
        {
            return;
        }

        isStart    = true;
        totalWave  = stream.Read <int>();
        deathCount = stream.Read <int>();
        int waveIndex = stream.Read <int>();

        preTime  = stream.Read <float>();
        coolTime = stream.Read <float>();

        MissionManager.Instance.m_PlayerMission.m_TowerUIData.TotalWaves        = totalWave;
        MissionManager.Instance.m_PlayerMission.m_TowerUIData.CurWavesRemaining = totalWave - waveIndex;
        MissionManager.Instance.m_PlayerMission.m_TowerUIData.bRefurbish        = true;
        MissionManager.Instance.m_PlayerMission.m_TowerUIData.MissionID         = MissionId;
        MissionManager.Instance.m_PlayerMission.m_TowerUIData.CurCount          = deathCount;
        MissionManager.Instance.m_PlayerMission.m_TowerUIData.PreTime           = preTime;

        if (UITowerInfo.Instance != null)
        {
            UITowerInfo.Instance.SetInfo(MissionManager.Instance.m_PlayerMission.m_TowerUIData);
            UITowerInfo.Instance.Show();
            StartCoroutine(CouterCoroutine());
        }
    }
Ejemplo n.º 21
0
    void RPC_S2C_FARM_DeletePlantTool(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        CSFarmData recordData = (CSFarmData)_ColonyObj._RecordData;
        int        itemObjId  = stream.Read <int>();
        int        key        = -1;

        foreach (var item in recordData.m_Tools)
        {
            if (item.Value == itemObjId)
            {
                key = item.Key;
                return;
            }
        }

        if (key != -1)
        {
            recordData.m_Tools.Remove(key);
        }

        if (CSUI_MainWndCtrl.Instance.FarmUI != null)
        {
            CSUI_MainWndCtrl.Instance.FarmUI.DeleteToolResult(m_Entity, itemObjId);
        }
    }
Ejemplo n.º 22
0
    void RPC_S2C_InitDataFarm(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        CSFarmData reocrdData = (CSFarmData)_ColonyObj._RecordData;

        reocrdData.m_CurDeleteTime = stream.Read <float>();
        reocrdData.m_CurRepairTime = stream.Read <float> ();
        reocrdData.m_DeleteTime    = stream.Read <float> ();
        reocrdData.m_Durability    = stream.Read <float> ();
        reocrdData.m_RepairTime    = stream.Read <float> ();
        reocrdData.m_RepairValue   = stream.Read <float> ();
        int [] seedkeys    = stream.Read <int[]> ();
        int [] seedvalues  = stream.Read <int[]> ();
        int [] toolskeys   = stream.Read <int[]> ();
        int [] toolsvalues = stream.Read <int[]> ();
        for (int i = 0; i < seedkeys.Length; i++)
        {
            reocrdData.m_PlantSeeds[seedkeys[i]] = seedvalues[i];
        }
        for (int i = 0; i < toolskeys.Length; i++)
        {
            reocrdData.m_Tools[toolskeys[i]] = toolsvalues[i];
        }
        reocrdData.m_AutoPlanting       = stream.Read <bool> ();
        reocrdData.m_SequentialPlanting = stream.Read <bool> ();
    }
Ejemplo n.º 23
0
    public static object Deserialize(BitStream stream, params object[] args)
    {
        PPIOutfits ppi = new PPIOutfits();

        ppi.Read(stream);
        return(ppi);
    }
Ejemplo n.º 24
0
    void RPC_S2C_EnterDungeon(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        bool success = stream.Read <bool>();

        if (!success)
        {
            MessageBox_N.CancelMask(MsgInfoType.DungeonGeneratingMask);
            return;
        }
        Vector3 genPlayerPos  = stream.Read <Vector3>();
        int     seed          = stream.Read <int>();
        int     dungeonId     = stream.Read <int>();
        int     dungeonDataId = stream.Read <int>();

        RandomDungenMgr.Instance.LoadDataFromId(dungeonDataId);
        //UILoadScenceEffect.Instance.EnableProgress(true);
        RandomDungenMgrData.DungeonId = dungeonId;
        RandomDungenMgrData.SetPosByGenPlayerPos(genPlayerPos);
        int failCount = 0;

        while (!RandomDungenMgr.Instance.GenDungeon(seed))
        {
            failCount++;
            Debug.Log("generation failed: " + failCount);
        }

        RandomDungenMgr.Instance.LoadPathFinding();
        RequestFastTravel(0, RandomDungenMgrData.revivePos, 0);
//		FastTravel.TravelTo(RandomDungenMgrData.revivePos);
    }
Ejemplo n.º 25
0
    public static object Deserialize(BitStream stream, params object[] args)
    {
        PPIRoundScore ppi = new PPIRoundScore();

        ppi.Read(stream);
        return(ppi);
    }
Ejemplo n.º 26
0
    // BitStream Writer
    public static void WriteToBitStream(uLink.BitStream stream, object val, params object[] args)
    {
        var obj = (WeaponBuild)val;

        stream.WriteByte((byte)obj.weaponId);
        stream.Write <AttunementBuild[]>(obj.attunements);
    }
Ejemplo n.º 27
0
    // @see StrictCharacterCreator.uLink_OnSerializeNetworkView()
    void uLink_OnSerializeNetworkView(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        MFDebugUtils.Assert(stream.isReading);

        Vector3 pos = stream.ReadVector3();
        Vector3 vel = stream.ReadVector3();

        Vector3 FireDir = stream.ReadVector3();

        byte quantBodyYaw = stream.ReadByte();

        float bodyYaw = NetUtils.DequantizeAngle(quantBodyYaw, 8);

        Quaternion bodyRotation = Quaternion.Euler(0, bodyYaw, 0);

        Owner.BlackBoard.FireDir = Owner.BlackBoard.Desires.FireDirection = FireDir;

        // on proxies, approximate fire place
        Owner.BlackBoard.Desires.FireTargetPlace = pos + FireDir * 10;

        if (Owner.IsAlive)
        {
            if (null != SmoothTransform)
            {
                double timestamp = SmoothTransform.GetTime(info);
                SmoothTransform.AddState(timestamp, pos, vel, bodyRotation);
            }
            else
            {
                SetTransform(pos, bodyRotation, vel);
            }
        }
    }
Ejemplo n.º 28
0
    public static object Deserialize(BitStream stream, params object[] args)
    {
        PPIInventoryList ppi = new PPIInventoryList();

        ppi.Read(stream);
        return(ppi);
    }
Ejemplo n.º 29
0
    void RPC_S2C_RPA_Start(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        string roleName = stream.Read <string> ();
        bool   success  = stream.Read <bool>();

        if (success)
        {
            //1.data
            CSRepairData recordData = (CSRepairData)_ColonyObj._RecordData;
            recordData.m_CurTime = 0;
            recordData.m_Time    = ((CSRepair)m_Entity).CountFinalTime();
            //recordData.m_Time = 20;
            if (m_Entity == null)
            {
                Debug.LogError("entity not ready");
                return;
            }
            ((CSRepair)m_Entity).StartCounter(recordData.m_CurTime, recordData.m_Time);

            //2.ui
            if (CSUI_MainWndCtrl.Instance.EngineeringUI != null)
            {
                CSUI_MainWndCtrl.Instance.EngineeringUI.StartWorkerResult(CSConst.etRepair, m_Entity, roleName);
            }
        }
    }
Ejemplo n.º 30
0
    void RPC_S2C_Plant_PutOut(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        Vector3    pos        = stream.Read <Vector3>();
        Quaternion rot        = stream.Read <Quaternion>();
        Vector3    scale      = stream.Read <Vector3>();
        int        instanceId = stream.Read <int>();

        ItemObject itemobj = ItemMgr.Instance.Get(instanceId);

        DragArticleAgent dragItem = DragArticleAgent.Create(itemobj.GetCmpt <Drag>(), pos, scale, rot, instanceId);

        FarmPlantLogic plant = dragItem.itemLogic as FarmPlantLogic;

        plant.InitInMultiMode();
        stream.Read <FarmPlantLogic>();
        plant.UpdateInMultiMode();

        //DragItem item = new DragItem(objID);

        //item.position = plantPos;
        //item.rotation = transform.rotation;
        //item.itemScript = null;
        ////item.DependType = dependType;
        //item.network = this;
        //DragItem.Mgr.Instance.Add(item);
    }
Ejemplo n.º 31
0
 public bool DoConnect(string strURL, int iPort)
 {
     unsafe
     {
         bool flag;
         SteamClient.Needed();
         NetCull.config.timeoutDelay = 60f;
         if (ClientConnect.Steam_GetSteamID() == 0)
         {
             LoadingScreen.Update("connection failed (no steam detected)");
             UnityEngine.Object.Destroy(base.gameObject);
             return false;
         }
         byte[] numArray = new byte[1024];
         IntPtr intPtr = Marshal.AllocHGlobal(1024);
         uint num = ClientConnect.SteamClient_GetAuth(intPtr, 1024);
         byte[] numArray1 = new byte[num];
         Marshal.Copy(intPtr, numArray1, 0, (int)num);
         Marshal.FreeHGlobal(intPtr);
         uLink.BitStream bitStream = new uLink.BitStream(false);
         bitStream.WriteInt32(1069);
         bitStream.WriteByte(2);
         bitStream.WriteUInt64(ClientConnect.Steam_GetSteamID());
         bitStream.WriteString(Marshal.PtrToStringAnsi(ClientConnect.Steam_GetDisplayname()));
         bitStream.WriteBytes(numArray1);
         try
         {
             NetError netError = NetCull.Connect(strURL, iPort, string.Empty, new object[] { bitStream });
             if (netError == NetError.NoError)
             {
                 SteamClient.SteamClient_OnJoinServer(strURL, iPort);
                 return true;
             }
             else
             {
                 LoadingScreen.Update(string.Concat("connection failed (", netError, ")"));
                 UnityEngine.Object.Destroy(base.gameObject);
                 flag = false;
             }
         }
         catch (Exception exception)
         {
             UnityEngine.Debug.LogException(exception);
             UnityEngine.Object.Destroy(base.gameObject);
             flag = false;
         }
         return flag;
     }
 }
Ejemplo n.º 32
0
 private void uLink_OnConnectedToServer()
 {
     LoadingScreen.Update("connected!");
     uLink.BitStream bitStream = new uLink.BitStream((byte[])NetCull.approvalData.ReadObject(typeof(byte[]).TypeHandle, new object[0]), false);
     string str = bitStream.ReadString();
     NetCull.sendRate = bitStream.ReadSingle();
     string str1 = bitStream.ReadString();
     bitStream.ReadBoolean();
     bitStream.ReadBoolean();
     if (bitStream.bytesRemaining > 8)
     {
         ulong num = bitStream.ReadUInt64();
         SteamClient.SteamUser_AdvertiseGame(num, bitStream.ReadUInt32(), bitStream.ReadInt32());
     }
     UnityEngine.Debug.Log(string.Concat("Server Name: \"", str1, "\""));
     UnityEngine.Debug.Log(string.Concat("Level Name: \"", str, "\""));
     UnityEngine.Debug.Log(string.Concat("Send Rate: ", NetCull.sendRate));
     NetCull.isMessageQueueRunning = false;
     base.StartCoroutine(this.LoadLevel(str));
     DisableOnConnectedState.OnConnected();
 }
Ejemplo n.º 33
0
 protected void ArmorData(byte[] data)
 {
     DamageTypeList damageTypeList = new DamageTypeList();
     uLink.BitStream bitStream = new uLink.BitStream(data, false);
     for (int i = 0; i < 6; i++)
     {
         damageTypeList[i] = bitStream.ReadSingle();
     }
     ProtectionTakeDamage protectionTakeDamage = this.takeDamage;
     if (protectionTakeDamage)
     {
         protectionTakeDamage.SetArmorValues(damageTypeList);
     }
     if (base.localPlayerControlled)
     {
         RPOS.SetEquipmentDirty();
     }
 }