-
Notifications
You must be signed in to change notification settings - Fork 0
/
BTN_choose_human.cs
84 lines (79 loc) · 3.56 KB
/
BTN_choose_human.cs
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
// Decompiled with JetBrains decompiler
// Type: BTN_choose_human
// Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
using ExitGames.Client.Photon;
using System.Collections.Generic;
using UnityEngine;
public class BTN_choose_human : MonoBehaviour
{
public bool isPlayerAllDead()
{
int num1 = 0;
int num2 = 0;
foreach (PhotonPlayer player in PhotonNetwork.playerList)
{
if ((int) player.customProperties[(object) PhotonPlayerProperty.isTitan] == 1)
{
++num1;
if ((bool) player.customProperties[(object) PhotonPlayerProperty.dead])
++num2;
}
}
return num1 == num2;
}
public bool isPlayerAllDead2()
{
int num1 = 0;
int num2 = 0;
foreach (PhotonPlayer player in PhotonNetwork.playerList)
{
if (RCextensions.returnIntFromObject(player.customProperties[(object) PhotonPlayerProperty.isTitan]) == 1)
{
++num1;
if (RCextensions.returnBoolFromObject(player.customProperties[(object) PhotonPlayerProperty.dead]))
++num2;
}
}
return num1 == num2;
}
private void OnClick()
{
string selection = GameObject.Find("PopupListCharacterHUMAN").GetComponent<UIPopupList>().selection;
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[0], true);
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().needChooseSide = false;
if (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.PVP_CAPTURE)
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().checkpoint = GameObject.Find("PVPchkPtH");
if (!PhotonNetwork.isMasterClient && (double) GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().roundTime > 60.0)
{
if (!this.isPlayerAllDead2())
{
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().NOTSpawnPlayer(selection);
}
else
{
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().NOTSpawnPlayer(selection);
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().photonView.RPC("restartGameByClient", PhotonTargets.MasterClient);
}
}
else if (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.BOSS_FIGHT_CT || IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.TROST || IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.PVP_CAPTURE)
{
if (this.isPlayerAllDead2())
{
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().NOTSpawnPlayer(selection);
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().photonView.RPC("restartGameByClient", PhotonTargets.MasterClient);
}
else
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().SpawnPlayer(selection);
}
else
GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>().SpawnPlayer(selection);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[1], false);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[2], false);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[3], false);
IN_GAME_MAIN_CAMERA.usingTitan = false;
GameObject.Find("MainCamera").GetComponent<IN_GAME_MAIN_CAMERA>().setHUDposition();
Hashtable propertiesToSet = new Hashtable();
((Dictionary<object, object>) propertiesToSet).Add((object) PhotonPlayerProperty.character, (object) selection);
PhotonNetwork.player.SetCustomProperties(propertiesToSet);
}
}