Cannot









How do I use Cannot
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: NetworkingPeer.cs Copy
2790     // Remove RPCs of view (if they are local player's RPCs)
2791     public void CleanRpcBufferIfMine(PhotonView view)
2792     {
2793         if (view.ownerId != this.mLocalActor.ID && !mLocalActor.isMasterClient)
2794         {
2795             Debug.LogError("Cannot remove cached RPCs on a PhotonView thats not ours! " + view.owner + " scene: " + view.isSceneView);
2796             return;
2797         }
2798
2799         this.OpCleanRpcBuffer(view);
2800     }
File name: NetworkingPeer.cs Copy
3499     private bool DeltaCompressionRead(PhotonView view, Hashtable data)
3500     {
3501         if (data.ContainsKey((byte)1))
3502         {
3503             // we have a full list of data (cause key 1 is used), so return "we have uncompressed all"
3504             return true;
3505         }
3506
3507         // Compression was applied as data[(byte)2] exists (this is the data with some fields being compressed to null)
3508         // now we also need a previous "full" list of values to restore values that are null in this msg
3509         if (view.lastOnSerializeDataReceived == null)
3510         {
3511             return false; // We dont have a full match yet, we cannot work with missing values: skip this message
3512         }
3513
3514         object[] compressedContents = data[(byte)2] as object[];
3515         if (compressedContents == null)
3516         {
3517             // despite expectation, there is no compressed data in this msg. shouldn't happen. just a null check
3518             return false;
3519         }
3520
3521         int[] indexesThatAreChangedToNull = data[(byte)3] as int[];
3522         if (indexesThatAreChangedToNull == null)
3523         {
3524             indexesThatAreChangedToNull = new int[0];
3525         }
3526
3527         object[] lastReceivedData = view.lastOnSerializeDataReceived;
3528         for (int index = 0; index < compressedContents.Length; index++)
3529         {
3530             if (compressedContents[index] == null && !indexesThatAreChangedToNull.Contains(index))
3531             {
3532                 // we replace null values in this received msg unless a index is in the "changed to null" list
3533                 object lastValue = lastReceivedData[index];
3534                 compressedContents[index] = lastValue;
3535             }
3536         }
3537
3538         data[(byte)1] = compressedContents; // compressedContents are now uncompressed...
3539         return true;
3540     }
File name: PhotonClasses.cs Copy
989         if (this.write)
990         {
991             Debug.LogError("Error: you cannot read this stream that you are writing!");
992             return null;
993         }
File name: PhotonClasses.cs Copy
1003         if (this.write)
1004         {
1005             Debug.LogError("Error: you cannot read this stream that you are writing!");
1006             return null;
1007         }
File name: PhotonClasses.cs Copy
1017         if (!this.write)
1018         {
1019             Debug.LogError("Error: you cannot write/send to this stream that you are reading!");
1020             return;
1021         }
File name: PhotonNetwork.cs Copy
2479     internal static void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
2480     {
2481         if (!VerifyCanUseNetwork())
2482         {
2483             return;
2484         }
2485
2486         if (room == null)
2487         {
2488             Debug.LogWarning("Cannot send RPCs in Lobby! RPC dropped.");
2489             return;
2490         }
2491
2492         if (networkingPeer != null)
2493         {
2494             networkingPeer.RPC(view, methodName, target, encrypt, parameters);
2495         }
2496         else
2497         {
2498             Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
2499         }
2500     }
File name: PhotonNetwork.cs Copy
2505     internal static void RPC(PhotonView view, string methodName, PhotonPlayer targetPlayer, bool encrpyt, params object[] parameters)
2506     {
2507         if (!VerifyCanUseNetwork())
2508         {
2509             return;
2510         }
2511
2512         if (room == null)
2513         {
2514             Debug.LogWarning("Cannot send RPCs in Lobby, only processed locally");
2515             return;
2516         }
2517
2518         if (player == null)
2519         {
2520             Debug.LogError("Error; Sending RPC to player null! Aborted \"" + methodName + "\"");
2521         }
2522
2523         if (networkingPeer != null)
2524         {
2525             networkingPeer.RPC(view, methodName, targetPlayer, encrpyt, parameters);
2526         }
2527         else
2528         {
2529             Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
2530         }
2531     }
File name: PhotonNetwork.cs Copy
2621     /// Helper function which is called inside this class to erify if certain functions can be used (e.g. RPC when not connected)
2624     private static bool VerifyCanUseNetwork()
2625     {
2626         if (connected)
2627         {
2628             return true;
2629         }
2630
2631         Debug.LogError("Cannot send messages when not connected. Either connect to Photon OR use offline mode!");
2632         return false;
2633     }
File name: PhotonPlayer.cs Copy
41     public string name {
42         get
43         {
44             return this.nameField;
45         }
46         set
47         {
48             if (!isLocal)
49             {
50                 Debug.LogError("Error: Cannot change the name of a remote player!");
51                 return;
52             }
53
54             this.nameField = value;
55         }
56     }
File name: InstructionsScript.cs Copy
27  void OnGUI() {
28   if (this.gameScript.gameView == "instructions") {
29    GUI.skin = currentGUISkin;
30
31    this.gameScript.mainCamera.transform.eulerAngles = new Vector3 (120, 23, 0);
32
33    GUIStyle labelStyle = new GUIStyle(currentGUISkin.label);
34    labelStyle.alignment = TextAnchor.UpperLeft;
35    GUILayout.Label ("Instructions", "BigLabel");
36
37
38    scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Screen.width), GUILayout.Height(Mathf.Ceil(Screen.height * .80f)));
39
40    GUILayout.Label ("Object", "Subheader");
41
42    GUILayout.Label (@"The object of 2048-3D is to"
43                  + " slide numbered blocks in such a way"
44                  + " so that blocks with the same numbers collide"
45                  + " and combine into a new block that is twice"
46                  + " as much as the originals until"
47                  + " the number 2048 is reached.", labelStyle);
48
49    GUILayout.Label ("Moving the Blocks", "Subheader");
50
51    GUILayout.Label (@"You cannot move blocks individually, but must"
52                 + " move all blocks simultaneously in the same direction."
53                 + " Blocks can move forward, backward, up, down, left"
54     + " and right along the green connectors."
55           + " Simply swipe any part of the screen to move up,"
56     + " down, left or right (keyboard: arrow keys). To move the"
57     + " blocks forward and backward use the"
58     + " big red arrow keys at the bottom of the screen (keyboard: a and z keys)."
59     + " When moving, all blocks that can slide in the chosen direction will move."
60     + " Any block moving toward another block with the same number will collide "
61        + " and form a single block with twice the number as the originals", labelStyle);
62
63
64    GUILayout.Label ("New Blocks", "Subheader");
65
66    GUILayout.Label (@"After each move is"
67                 + " made a new block will appear randomly in an empty position."
68                 + " This block will have a number of either 2 or 4."
69        + " For an extra challenge, there is a game option you can"
70        + " set so that zeros can also be assinged to a new block."
71        + " Zeros act like any other number in that they can"
72        + " collide with other zeros to make a block twice as much "
73        + " (which is still zero).", labelStyle);
74
75
76
77    GUILayout.Label ("Scoring and Finishing", "Subheader");
78
79    GUILayout.Label(@"For every block collision that occurs you receive"
80                 + " the number of points of the newly"
81                 + " created block. If after making a move"
82                 + " all positions are filled and no new"
83                 + " moves are possible, the game ends."
84        + " A separate high score / highest block is kept for each"
85        + " distinct combination of game options", labelStyle);
86
87
88    GUILayout.Label ("Game Layout Options", "Subheader");
89
90    GUILayout.Label (@"When I first made this game there"
91            + " was only one game layout, a 3x3x3 cube."
92            + " After testing it a bit, it was way to easy"
93            + " so the zero option was added."
94            + " It was still way to easy "
95            + " (e.g. you could swipe without even looking and get pretty far)."
96            + " Therefore there are now several diffent game layouts that"
97            + " make the game more challenging and fun.", labelStyle);
98
99    GUILayout.Label ("Game Timer Option", "Subheader");
100
101    GUILayout.Label (@"To give yourself even more of a challenge"
102                     + " you can set game options to include a timer."
103                     + " If a timer is chosen you have a specific"
104                     + " amount of time to combined blocks to make the 64 block."
105                     + " If you run out of time the game is over."
106                     + " If you reach your target before the timer runs down you will"
107                     + " receive additional time to reach the next target."
108                     + " The time you received is as follows: \n"
109                     + " 64: option time + 5 seconds (because the first one is the hardest!)\n"
110                     + " 128: option time\n"
111                     + " 256: 2X option time\n"
112                     + " 512: 4X option time \n"
113                     + " 1024: 8X option time \n"
114                     + " you get the idea.", labelStyle);
115
116
117    GUILayout.Label ("Acknowledgements \nand Confessions", "Subheader");
118
119    GUILayout.Label (@"2048-3D is based upon the original" +
120                     " 2048 game designed by Gabriele Cirulli " +
121                     " \n\n" +
122                     " Sound effects by freeSFX http://www.freesfx.co.uk.\n\n" +
123                     " This game was designed using the Unity3D game engine.\n\n" +
124                     " FOR MORE PROJECTS VISIT:" +
125                     " https://code-projects.org/", labelStyle);
126
127
128    foreach (Touch touch in Input.touches) {
129     if (touch.phase == TouchPhase.Moved)
130     {
131      // dragging
132      this.scrollPosition.y += touch.deltaPosition.y;
133     }
134    }
135    GUILayout.EndScrollView();
136
137    if (GUILayout.Button ("Return to Menu")) {
138     this.gameScript.gameView = "menu";
139    }
140   }
141  }

Cannot 95 lượt xem

Gõ tìm kiếm nhanh...