1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
using System;
using ExitGames.Client.Photon;
using Photon.Pun;
using UnityEngine;
public class Player : MonoBehaviour
{
public int playerID;
public int teamID;
[HideInInspector]
public CharacterData data;
public PlayerSkinBank colors;
private void Awake()
{
data = GetComponent<CharacterData>();
}
private void Start()
{
if (!data.view.IsMine)
{
ReadPlayerID();
ReadTeamID();
PlayerAssigner.instance.OtherPlayerWasCreated();
}
else
{
int num = 0;
if (!PhotonNetwork.OfflineMode)
{
try
{
num = 0;
PlayerFace playerFace = CharacterCreatorHandler.instance.selectedPlayerFaces[num];
data.view.RPC("RPCA_SetFace", RpcTarget.All, playerFace.eyeID, playerFace.eyeOffset, playerFace.mouthID, playerFace.mouthOffset, playerFace.detailID, playerFace.detailOffset, playerFace.detail2ID, playerFace.detail2Offset);
}
catch
{
}
}
else if (GM_ArmsRace.instance != null)
{
GM_ArmsRace instance = GM_ArmsRace.instance;
instance.StartGameAction = (Action)Delegate.Combine(instance.StartGameAction, new Action(GetFaceOffline));
}
}
PlayerManager.instance.PlayerJoined(this);
}
public void GetFaceOffline()
{
PlayerFace playerFace = CharacterCreatorHandler.instance.selectedPlayerFaces[playerID];
data.view.RPC("RPCA_SetFace", RpcTarget.All, playerFace.eyeID, playerFace.eyeOffset, playerFace.mouthID, playerFace.mouthOffset, playerFace.detailID, playerFace.detailOffset, playerFace.detail2ID, playerFace.detail2Offset);
}
[PunRPC]
public void RPCA_SetFace(int eyeID, Vector2 eyeOffset, int mouthID, Vector2 mouthOffset, int detailID, Vector2 detailOffset, int detail2ID, Vector2 detail2Offset)
{
PlayerFace face = PlayerFace.CreateFace(eyeID, eyeOffset, mouthID, mouthOffset, detailID, detailOffset, detail2ID, detail2Offset);
GetComponentInChildren<CharacterCreatorItemEquipper>().EquipFace(face);
}
internal void Call_AllGameFeel(Vector2 vector2)
{
data.view.RPC("RPCA_AllGameFeel", RpcTarget.All, vector2);
}
[PunRPC]
internal void RPCA_AllGameFeel(Vector2 vector2)
{
GamefeelManager.instance.AddGameFeel(vector2);
}
public void AssignPlayerID(int ID)
{
playerID = ID;
SetColors();
if (!PhotonNetwork.OfflineMode)
{
Hashtable customProperties = PhotonNetwork.LocalPlayer.CustomProperties;
if (customProperties.ContainsKey("PlayerID"))
{
customProperties["PlayerID"] = playerID;
}
else
{
customProperties.Add("PlayerID", playerID);
}
PhotonNetwork.LocalPlayer.SetCustomProperties(customProperties);
}
}
internal float GetRadius()
{
return 5f;
}
private void ReadPlayerID()
{
if (!PhotonNetwork.OfflineMode)
{
playerID = (int)data.view.Owner.CustomProperties["PlayerID"];
SetColors();
}
}
public void AssignTeamID(int ID)
{
teamID = ID;
if (!PhotonNetwork.OfflineMode)
{
Hashtable customProperties = PhotonNetwork.LocalPlayer.CustomProperties;
if (customProperties.ContainsKey("TeamID"))
{
customProperties["TeamID"] = playerID;
}
else
{
customProperties.Add("TeamID", teamID);
}
PhotonNetwork.LocalPlayer.SetCustomProperties(customProperties);
}
}
private void ReadTeamID()
{
if (!PhotonNetwork.OfflineMode)
{
teamID = (int)data.view.Owner.CustomProperties["TeamID"];
}
}
public void SetColors()
{
SetTeamColor.TeamColorThis(base.gameObject, PlayerSkinBank.GetPlayerSkinColors(playerID));
}
public PlayerSkin GetTeamColors()
{
return PlayerSkinBank.GetPlayerSkinColors(playerID);
}
internal void FullReset()
{
data.weaponHandler.NewGun();
data.stats.ResetStats();
data.block.ResetStats();
}
}
|