• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NetworkView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NetworkView的典型用法代码示例。如果您正苦于以下问题:C# NetworkView类的具体用法?C# NetworkView怎么用?C# NetworkView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NetworkView类属于命名空间,在下文中一共展示了NetworkView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AllocateNetworkViewID

	public void AllocateNetworkViewID(string _requestID, NetworkView _networkView)
	{
		if (mAllocateRequests.ContainsKey(_requestID))
		{
			Debug.Log("Request " + _requestID + " is incomplete. Please wait.");
			return;
		}

		if (mAllocationCache.ContainsKey(_requestID)) 
		{
			_networkView.viewID = mAllocationCache[_requestID];
			return;
		}

		if (Network.isServer) 
		{
			_networkView.viewID = Network.AllocateViewID();
			mAllocationCache.Add(_requestID, _networkView.viewID);
		}
		else if (Network.isClient)
		{
			mAllocateRequests.Add(_requestID, new WeakReference(_networkView));
			networkView.RPC("NetworkViewAllocator_RequestViewID", RPCMode.Server, Network.player, _requestID);
		}
		else 
		{
			Debug.Log("The connect is not established yet, try after connected to server.");
			return;
		}
	}
开发者ID:kiki9014,项目名称:snugdc-project-ricochet,代码行数:30,代码来源:NetworkViewAllocator.cs


示例2: CombatHandler

    public CombatHandler(NetworkView nv)
    {
        _nv = nv;

        //Get Memory for the list
        _effectDictionary = new Dictionary<PlayerObject, List<DynamicEffect>>(SIZE);
    }
开发者ID:CKovacs,项目名称:JnRProject,代码行数:7,代码来源:CombatHandler.cs


示例3: Awake

 void Awake()
 {
     cam = GetComponentInChildren<Camera>();
     animator = (Animator)GetComponent<Animator> ();
     networkView = GetComponent<NetworkView> ();
     Respawn ();
 }
开发者ID:terdened,项目名称:Tanks,代码行数:7,代码来源:Player.cs


示例4: Start

 void Start()
 {
     m_animator = GetComponentInChildren<Animator>();
     myNetworkView = GetComponent<NetworkView>();
     myAudioSource = GetComponent<AudioSource>();
     SetColliders( false );
 }
开发者ID:EricEspinoza,项目名称:GalleryRailShooter,代码行数:7,代码来源:Target.cs


示例5: Start

 void Start()
 {
     tParent = transform.parent;
     networkView = tParent.GetComponent <NetworkView>();
     gameObject.SetActive(networkView.isMine);
     gm = GameManager.Instance;
 }
开发者ID:bruteostrich,项目名称:GnomeArena,代码行数:7,代码来源:CamHandler.cs


示例6: Awake

 void Awake()
 {
     animationState = 0;
     animator = (Animator)GetComponent<Animator> ();
     animator.SetInteger ("State", animationState);
     networkView = GetComponent<NetworkView> ();
 }
开发者ID:terdened,项目名称:Tanks,代码行数:7,代码来源:Bulet.cs


示例7: Start

 // Use this for initialization
 void Start()
 {
     gameLogic = GameObject.Find("GameLogic").GetComponent<RPCUpdates>();
     audio = GetComponent<AudioSource>();
     sphere = GetComponent<Rigidbody> ();
     nV = GetComponent<NetworkView>();
 }
开发者ID:znafz,项目名称:foos,代码行数:8,代码来源:playerMovement.cs


示例8: OnConnectedToServer

 void OnConnectedToServer()
 {
     if (Server.g && Server.g.IsClient()) {
         m_networkView = GetComponent<NetworkView>();
         Server.g.SyncViewIds (m_networkView, "Avatar");
     }
 }
开发者ID:jceipek,项目名称:ORGI,代码行数:7,代码来源:AvatarNetworking.cs


示例9: Find

        /// <summary>
        /// find a networkview based on a networkviewid that was serialized into an rpc
        /// </summary>
        /// <param name="message">uses deserialize, so the read location does advance</param>
        /// <param name="view"></param>
        /// <returns></returns>
        public bool Find(ref NetIncomingMessage message, out NetworkView view)
        {
            var id = new NetworkViewId();
            id.OnDeserialize(message);

            return Find(id, out view);
        }
开发者ID:traleven,项目名称:PNet,代码行数:13,代码来源:NetworkViewManager.cs


示例10: OnTriggerStay

    void OnTriggerStay(Collider coll)
    {
        if (coll.tag == "Player")
        {
           // GameObject hitPlayer = coll.gameObject;

            nView = coll.GetComponent<NetworkView>();

            nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);

        }
        if (coll.tag == "Boss")
        {
            // GameObject hitPlayer = coll.gameObject;
            nView = coll.GetComponent<NetworkView>();
            nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);

            if (nView.isMine)
            {
                Sentry companion;
                companion = nView.GetComponent<Sentry>();
                companion.ClientTakeDamageFromWeapon(1);
            }
            else
            {
                nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 1);
            }
        }
    }
开发者ID:Dankerprouduct,项目名称:Derp-Bots,代码行数:29,代码来源:Fire.cs


示例11: Start

	public void Start ()
	{
		//Initializes on start up to listen for messages
		//make sure this game object has both UDPPackIO and OSC script attached
		
		UDPPacketIO udp = (UDPPacketIO)GetComponent("UDPPacketIO");
		udp.init(RemoteIP, SendToPort, ListenerPort);
		handler = (Osc)GetComponent("Osc");
		handler.init(udp);
		handler.SetAllMessageHandler(AllMessageHandler);


		tornadoSlider = GameObject.Find("Tornado Slider").GetComponent<UnityEngine.UI.Slider>();
		munchkinSlider = GameObject.Find("Munchkin Slider").GetComponent<UnityEngine.UI.Slider>();
		poppySlider = GameObject.Find("Poppy Slider").GetComponent<UnityEngine.UI.Slider>();
		monkeySlider = GameObject.Find("Monkey Slider").GetComponent<UnityEngine.UI.Slider>();
		fireSlider = GameObject.Find("Fire Slider").GetComponent<UnityEngine.UI.Slider>();
		transSpeedSlider = GameObject.Find("Transition Slider").GetComponent<UnityEngine.UI.Slider>();


		nv = GameObject.Find("Network").GetComponent<NetworkView>();

		Debug.Log("Osc Running");
		
	}
开发者ID:theomission,项目名称:ozUnity,代码行数:25,代码来源:OzOscReceiver.cs


示例12: Start

 // Use this for initialization
 void Start()
 {
     //myInputBox = GetComponentInChildren<UnityEngine.UI.InputField>();
     //myChatBox = GetComponentInChildren<UnityEngine.UI.Text>();
     myNetworkView = GetComponent<NetworkView>();
     myNetworkManager = Camera.main.GetComponent<NetworkManager>();
 }
开发者ID:hongaaronc,项目名称:IntermediateGame,代码行数:8,代码来源:Chat.cs


示例13: addScopeNetView

 public void addScopeNetView(NetworkView[] pNetworkViews)
 {
     foreach (var lNetworkView in pNetworkViews)
     {
         addScopeNetView(lNetworkView);
     }
 }
开发者ID:Seraphli,项目名称:TheInsectersWar,代码行数:7,代码来源:BoundNetworkScope.cs


示例14: Awake

	void Awake()
	{
		MyNetworkView = gameObject.GetComponent<NetworkView> ();
		OnlineName = gameObject.name;
		// maybe reload the last used name from PlayerPrefs or generate a random name
		BroadcastNickName();
	}
开发者ID:Deus0,项目名称:Zeltex,代码行数:7,代码来源:NetworkedPlayer.cs


示例15: Buffer

	public static void Buffer(NetworkView view, string func, RPCMode mode, params object[] args) 
	{
		//first fix up the mode so no one accidentally passes in a buffered mode
		if(mode == RPCMode.AllBuffered)
			mode = RPCMode.All;
		else if(mode  == RPCMode.OthersBuffered)
			mode = RPCMode.Others;
			
		if(m_RPCs == null)
			m_RPCs = new BufferedRPC[0];
		BufferedRPC [] temp = new BufferedRPC[m_RPCs.Length+1];
		if(m_RPCs.Length > 0)
			m_RPCs.CopyTo(temp,0);
		
		BufferedRPC tempRPC = new BufferedRPC();
		tempRPC.func = func;
		tempRPC.mode = mode;
		if(args != null)
		{
			// for(int i = 0; i < args.Length; i++)
				// Debug.Log(args[i].ToString() + ", ");
			tempRPC.args = new object[args.Length];
			args.CopyTo(tempRPC.args,0);
		}
		tempRPC.view = view;
		temp[temp.Length-1] = tempRPC;
		m_RPCs = temp;
		
		view.RPC(func, mode, args);
	}
开发者ID:richard3d,项目名称:BlitzBeez,代码行数:30,代码来源:ServerRPC.cs


示例16: Allocate

    public void Allocate(string _requestKey, NetworkView _networkView, Action _callback)
    {
        NetworkViewID _bufferedViewID;
        if (mAllocationBuffer.TryGetValue(_requestKey, out _bufferedViewID))
        {
            _networkView.viewID = _bufferedViewID;
            return;
        }

        if (mAllocateRequests.ContainsKey(_requestKey))
        {
            Debug.Log("Request " + _requestKey + " is incomplete. Please wait.");
            return;
        }

        if (Network.isServer)
        {
            _networkView.viewID = Network.AllocateViewID();
            mAllocationBuffer.Add(_requestKey, _networkView.viewID);
        }
        else if (Network.isClient)
        {
            var _job = new AllocationJob();
            _job.networkView = _networkView;
            _job.callback = _callback;
            mAllocateRequests.Add(_requestKey, _job);
            networkView.RPC("NetworkViewAllocator_RequestViewID", RPCMode.Server, Network.player, _requestKey);
        }
        else
        {
            Debug.Log("The connect is not established yet, try after connected to server.");
            return;
        }
    }
开发者ID:JamesKim2998,项目名称:snugdc-project-ricochet,代码行数:34,代码来源:NetworkViewAllocator.cs


示例17: Start

 void Start()
 {
     Debug.Log("Start: " + name + " id:" + GetInstanceID());
     netView = GetComponent<NetworkView>();
     if (isNotMine) {
         collider.enabled = false;
     }
 }
开发者ID:MedeirosMarcelo,项目名称:TowerFall,代码行数:8,代码来源:ShieldPickup.cs


示例18: Awake

 // Use this for initialization
 void Awake()
 {
     //Objekt soll bestehen bleiben
     DontDestroyOnLoad(this);
     netView = gameObject.GetComponent<NetworkView>();
     // NetworkView ID | Spielername | gewähltes Autos (Default: Dodge Charger Lee), abhängig vom ersten Auto in Carselection | ist Spieler bereit?
     playerData = new string[]{netView.viewID.ToString(), PlayerPrefs.GetString("PlayerOneName"), "Dodge Charger Lee", "nicht bereit"};
 }
开发者ID:NoBudgetGames,项目名称:LastIgnition,代码行数:9,代码来源:NetworkPlayerData.cs


示例19: OnTriggerEnter

 void OnTriggerEnter(Collider other)
 {
     if(other.tag == "Player")
     {
         nView = other.GetComponent<NetworkView>();
         nView.RPC("NetworkTakeDamageFromWeapon", nView.owner, 50);
     }
 }
开发者ID:Dankerprouduct,项目名称:Derp-Bots,代码行数:8,代码来源:DestroyTime.cs


示例20: Awake

 // Use this for initialization
 void Awake()
 {
     nView = GetComponent<NetworkView>();
     if(!nView.isMine) enabled = false;
     Name = Get.Name;
     CreateNeeds();
     SetDress ();
 }
开发者ID:zjucsxxd,项目名称:goodsireartthoumyslayer,代码行数:9,代码来源:Player.cs



注:本文中的NetworkView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NewEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# NetworkTestClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap