void Start()
 {
     CheckBoxCostume.costumeSet = (int)FengGameManagerMKII.settings[412];
     id = "TITAN";
     if (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.PVP_AHSS)
     {
         id = "AHSS";
     }
     HeroStat.initDATA();
     if (((IN_GAME_MAIN_CAMERA.singleCharacter != "Set 1") && (IN_GAME_MAIN_CAMERA.singleCharacter != "Set 2")) && (IN_GAME_MAIN_CAMERA.singleCharacter != "Set 3"))
     {
         stat = HeroStat.getInfo(IN_GAME_MAIN_CAMERA.singleCharacter);
     }
     else
     {
         HeroCostume costume = CostumeConeveter.LocalDataToHeroCostume(IN_GAME_MAIN_CAMERA.singleCharacter);
         if (costume == null)
         {
             stat = new HeroStat();
         }
         else
         {
             stat = costume.stat;
         }
         stat.name = IN_GAME_MAIN_CAMERA.singleCharacter;
     }
     if (PanelEnterGame.instance != null)
     {
         PanelEnterGame.instance.to_InfoHero(stat);
     }
 }
Beispiel #2
0
    public static HeroCostume LocalDataToHeroCostume(string slot)
    {
        slot = slot.ToUpper();
        if (!PlayerPrefs.HasKey(slot + PhotonPlayerProperty.sex))
        {
            return(HeroCostume.costume[0]);
        }
        HeroCostume heroCostume = new HeroCostume();

        heroCostume.sex              = IntToSex(PlayerPrefs.GetInt(slot + PhotonPlayerProperty.sex));
        heroCostume.id               = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.heroCostumeId);
        heroCostume.costumeId        = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.costumeId);
        heroCostume.cape             = (PlayerPrefs.GetInt(slot + PhotonPlayerProperty.cape) == 1);
        heroCostume.hairInfo         = ((heroCostume.sex != Sex.Male) ? CostumeHair.hairsF[PlayerPrefs.GetInt(slot + PhotonPlayerProperty.hairInfo)] : CostumeHair.hairsM[PlayerPrefs.GetInt(slot + PhotonPlayerProperty.hairInfo)]);
        heroCostume.eye_texture_id   = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.eye_texture_id);
        heroCostume.beard_texture_id = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.beard_texture_id);
        heroCostume.glass_texture_id = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.glass_texture_id);
        heroCostume.skin_color       = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.skin_color);
        heroCostume.hair_color       = new Color(PlayerPrefs.GetFloat(slot + PhotonPlayerProperty.hair_color1), PlayerPrefs.GetFloat(slot + PhotonPlayerProperty.hair_color2), PlayerPrefs.GetFloat(slot + PhotonPlayerProperty.hair_color3));
        heroCostume.division         = CostumeConeveter.IntToDivision(PlayerPrefs.GetInt(slot + PhotonPlayerProperty.division));
        heroCostume.stat             = new HeroStat();
        heroCostume.stat.Spd         = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.statSPD);
        heroCostume.stat.Gas         = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.statGAS);
        heroCostume.stat.Bla         = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.statBLA);
        heroCostume.stat.Acl         = PlayerPrefs.GetInt(slot + PhotonPlayerProperty.statACL);
        heroCostume.stat.skillID     = PlayerPrefs.GetString(slot + PhotonPlayerProperty.statSKILL);
        heroCostume.setBodyByCostumeId(-1);
        heroCostume.setMesh();
        heroCostume.setTexture();
        return(heroCostume);
    }
Beispiel #3
0
    private void onCharacterChange()
    {
        string   selection = base.GetComponent <UIPopupList>().selection;
        HeroStat heroStat;

        if (selection == "Set 1" || selection == "Set 2" || selection == "Set 3")
        {
            HeroCostume heroCostume = CostumeConeveter.LocalDataToHeroCostume(selection.ToUpper());
            if (heroCostume == null)
            {
                heroStat = new HeroStat();
            }
            else
            {
                heroStat = heroCostume.stat;
            }
        }
        else
        {
            heroStat = HeroStat.getInfo(base.GetComponent <UIPopupList>().selection);
        }
        this.SPD.transform.localScale = new Vector3((float)heroStat.Spd, 20f, 0f);
        this.GAS.transform.localScale = new Vector3((float)heroStat.Gas, 20f, 0f);
        this.BLA.transform.localScale = new Vector3((float)heroStat.Bla, 20f, 0f);
        this.ACL.transform.localScale = new Vector3((float)heroStat.Acl, 20f, 0f);
    }
Beispiel #4
0
    private void onCharacterChange()
    {
        HeroStat stat;
        string   selection = base.GetComponent <UIPopupList>().selection;

        switch (selection)
        {
        case "Set 1":
        case "Set 2":
        case "Set 3":
        {
            HeroCostume costume = CostumeConeveter.LocalDataToHeroCostume(selection.ToUpper());
            if (costume == null)
            {
                stat = new HeroStat();
            }
            else
            {
                stat = costume.stat;
            }
            break;
        }

        default:
            stat = HeroStat.getInfo(base.GetComponent <UIPopupList>().selection);
            break;
        }
        this.SPD.transform.localScale = new Vector3((float)stat.SPD, 20f, 0f);
        this.GAS.transform.localScale = new Vector3((float)stat.GAS, 20f, 0f);
        this.BLA.transform.localScale = new Vector3((float)stat.BLA, 20f, 0f);
        this.ACL.transform.localScale = new Vector3((float)stat.ACL, 20f, 0f);
    }
Beispiel #5
0
 private void SpawnAHSS()
 {
     if (character.Contains("SET"))
     {
         var set = CostumeConeveter.LocalDataToHeroCostume(character);
         if (set.costumeId != 25 && set.costumeId != 26)
         {
             character = "AHSS";
         }
     }
     else
     {
         character = "AHSS";
     }
     FengGameManagerMKII.FGM.needChooseSide = false;
     if (!PhotonNetwork.IsMasterClient && FengGameManagerMKII.FGM.logic.RoundTime > 60f)
     {
         FengGameManagerMKII.FGM.NotSpawnPlayer(character);
         FengGameManagerMKII.FGM.BasePV.RPC("restartGameByClient", PhotonTargets.MasterClient, new object[0]);
     }
     else
     {
         FengGameManagerMKII.FGM.SpawnPlayerAt(character, FengGameManagerMKII.Level.Name.Contains("Custom") ? string.Empty : "playerRespawn2");
     }
     IN_GAME_MAIN_CAMERA.usingTitan = false;
     IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition();
     PhotonNetwork.player.Character = character;
 }
Beispiel #6
0
    public void LoadData()
    {
        HeroCostume from = CostumeConeveter.LocalDataToHeroCostume(this.currentSlot);

        if (from != null)
        {
            this.copyCostume(from, this.setup.myCostume, false);
            this.setup.deleteCharacterComponent2();
            this.setup.setCharacterComponent();
        }
        this.CostumeDataToMyID();
        this.freshLabel();
    }
Beispiel #7
0
    public void LoadData()
    {
        var from = CostumeConeveter.LocalDataToHeroCostume(currentSlot);

        if (from != null)
        {
            copyCostume(from, setup.myCostume);
            setup.deleteCharacterComponent2();
            setup.setCharacterComponent();
        }

        CostumeDataToMyID();
        freshLabel();
    }
Beispiel #8
0
 public static void HeroCostumeToLocalData(HeroCostume costume, string slot)
 {
     slot = slot.ToUpper();
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.sex, CostumeConeveter.SexToInt(costume.sex));
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.costumeId, costume.costumeId);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.heroCostumeId, costume.id);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.cape, (!costume.cape) ? 0 : 1);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.hairInfo, costume.hairInfo.id);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.eye_texture_id, costume.eye_texture_id);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.beard_texture_id, costume.beard_texture_id);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.glass_texture_id, costume.glass_texture_id);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.skin_color, costume.skin_color);
     PlayerPrefs.SetFloat(slot + PhotonPlayerProperty.hair_color1, costume.hair_color.r);
     PlayerPrefs.SetFloat(slot + PhotonPlayerProperty.hair_color2, costume.hair_color.g);
     PlayerPrefs.SetFloat(slot + PhotonPlayerProperty.hair_color3, costume.hair_color.b);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.division, CostumeConeveter.DivisionToInt(costume.division));
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.statSPD, costume.stat.Spd);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.statGAS, costume.stat.Gas);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.statBLA, costume.stat.Bla);
     PlayerPrefs.SetInt(slot + PhotonPlayerProperty.statACL, costume.stat.Acl);
     PlayerPrefs.SetString(slot + PhotonPlayerProperty.statSKILL, costume.stat.skillID);
 }
Beispiel #9
0
    private void updateCostume(int id)
    {
        IN_GAME_MAIN_CAMERA component = GameObject.Find("MainCamera").GetComponent <IN_GAME_MAIN_CAMERA>();
        HeroCostume         costume2  = CostumeConeveter.LocalDataToHeroCostume("SET " + id);

        component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().init();

        if (costume2 != null)
        {
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume      = costume2;
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume.stat = costume2.stat;
        }
        else
        {
            costume2 = HeroCostume.costumeOption[3];
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume      = costume2;
            component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().myCostume.stat = HeroStat.getInfo(costume2.name.ToUpper());
        }

        component.main_object.GetComponent <HERO>().GetComponent <HERO_SETUP>().setCharacterComponent();
        component.main_object.GetComponent <HERO>().setStat();
        component.main_object.GetComponent <HERO>().setSkillHUDPosition();
    }
Beispiel #10
0
 public static void HeroCostumeToPhotonData(HeroCostume costume, PhotonPlayer player)
 {
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.sex,
             CostumeConeveter.SexToInt(costume.sex)
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.costumeId,
             costume.costumeId
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.heroCostumeId,
             costume.id
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.cape,
             costume.cape
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.hairInfo,
             costume.hairInfo.id
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.eye_texture_id,
             costume.eye_texture_id
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.beard_texture_id,
             costume.beard_texture_id
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.glass_texture_id,
             costume.glass_texture_id
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.skin_color,
             costume.skin_color
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.hair_color1,
             costume.hair_color.r
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.hair_color2,
             costume.hair_color.g
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.hair_color3,
             costume.hair_color.b
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.division,
             CostumeConeveter.DivisionToInt(costume.division)
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.statSPD,
             costume.stat.Spd
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.statGAS,
             costume.stat.Gas
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.statBLA,
             costume.stat.Bla
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.statACL,
             costume.stat.Acl
         }
     });
     player.SetCustomProperties(new Hashtable
     {
         {
             PhotonPlayerProperty.statSKILL,
             costume.stat.skillID
         }
     });
 }
Beispiel #11
0
 public void SaveData()
 {
     CostumeConeveter.HeroCostumeToLocalData(this.setup.myCostume, this.currentSlot);
 }
Beispiel #12
0
    private void spawnPlayerAtRPC(float posX, float posY, float posZ, PhotonMessageInfo info)
    {
        if (info.Sender.IsMasterClient && CustomLevel.logicLoaded && CustomLevel.customLevelLoaded && !needChooseSide &&
            IN_GAME_MAIN_CAMERA.MainCamera.gameOver)
        {
            var pos       = new Vector3(posX, posY, posZ);
            var component = IN_GAME_MAIN_CAMERA.MainCamera;
            var id        = myLastHero.ToUpper();
            myLastHero = id;
            component.SetMainObject(
                Pool.NetworkEnable("AOTTG_HERO 1", pos, Quaternion.identity).GetComponent <HERO>());
            id = id.ToUpper();
            if (id == "SET 1" || id == "SET 2" || id == "SET 3")
            {
                var heroCostume2 = CostumeConeveter.LocalDataToHeroCostume(id);
                heroCostume2.Checkstat();
                CostumeConeveter.HeroCostumeToLocalData(heroCostume2, id);
                IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();

                IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = heroCostume2;
                IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat = heroCostume2.stat;

                IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
            }
            else
            {
                for (var j = 0; j < HeroCostume.costume.Length; j++)
                {
                    if (HeroCostume.costume[j].name.ToUpper() == id.ToUpper())
                    {
                        var num2 = HeroCostume.costume[j].id;
                        if (id.ToUpper() != "AHSS")
                        {
                            num2 += CheckBoxCostume.costumeSet - 1;
                        }

                        if (HeroCostume.costume[num2].name != HeroCostume.costume[j].name)
                        {
                            num2 = HeroCostume.costume[j].id + 1;
                        }

                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = HeroCostume.costume[num2];
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat =
                            HeroStat.getInfo(HeroCostume.costume[num2].name.ToUpper());
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                        IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                        IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
                        break;
                    }
                }
            }

            CostumeConeveter.HeroCostumeToPhotonData(IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume,
                                                     PhotonNetwork.player);
            if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
            {
                IN_GAME_MAIN_CAMERA.MainT.position += new Vector3(Random.Range(-20, 20), 2f,
                                                                  Random.Range(-20, 20));
            }

            PhotonNetwork.player.Dead    = false;
            PhotonNetwork.player.IsTitan = false;
            component.enabled            = true;
            IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition();
            IN_GAME_MAIN_CAMERA.SpecMov.disable = true;
            IN_GAME_MAIN_CAMERA.Look.disable    = true;
            component.gameOver = false;
            Screen.lockCursor  = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS;
            Screen.showCursor  = false;
            ShowHUDInfoCenter(string.Empty);
        }
    }
    void OnGUI()
    {
        GUI.backgroundColor = INC.gui_color;
        GUILayout.BeginArea(new Rect(0, 0, 300, Screen.height));
        GUILayout.BeginVertical(GUI.skin.box);
        int ist = isTitan;

        isTitan = GUILayout.SelectionGrid(isTitan, new string[] { "HUMAN", id }, 2);
        if (ist != isTitan)
        {
            if (!LevelInfo.getInfo(FengGameManagerMKII.level).teamTitan)
            {
                isTitan = 0;
            }
        }
        if (isTitan == 0)
        {
            GUIStyle style = new GUIStyle(GUI.skin.button);
            foreach (var stats in HeroStat.stats)
            {
                if (stats.Key != "CUSTOM_DEFAULT")
                {
                    if (stat != null)
                    {
                        if (stat.name == stats.Key)
                        {
                            style.normal = GUI.skin.button.active;
                        }
                        else
                        {
                            style.normal = GUI.skin.button.normal;
                        }
                    }
                    if (GUILayout.Button(stats.Key, style))
                    {
                        IN_GAME_MAIN_CAMERA.singleCharacter = stats.Key;
                        if (((stats.Key != "Set 1") && (stats.Key != "Set 2")) && (stats.Key != "Set 3"))
                        {
                            stat = HeroStat.getInfo(stats.Key);
                        }
                        else
                        {
                            HeroCostume costume = CostumeConeveter.LocalDataToHeroCostume(stats.Key);
                            if (costume == null)
                            {
                                stat = new HeroStat();
                            }
                            else
                            {
                                stat = costume.stat;
                            }
                        }
                        if (PanelEnterGame.instance != null)
                        {
                            PanelEnterGame.instance.to_InfoHero(stat);
                        }
                        stat.name = stats.Key;
                    }
                }
            }
            if (stat != null)
            {
                GUILayout.Label(stat.name);
                GUILayout.BeginHorizontal();
                GUILayout.Label("SPD:" + stat.SPD);
                GUILayout.Label("ACL:" + stat.ACL);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.Label("BLA:" + stat.BLA);
                GUILayout.Label("GAS:" + stat.GAS);
                GUILayout.EndHorizontal();
            }
            string[] cos = new string[] { "Cos 1", "Cos 2", "Cos 3" };
            GUILayout.BeginHorizontal();
            GUIStyle style3 = new GUIStyle(GUI.skin.button);
            for (int s = 0; s < cos.Length; s++)
            {
                string de = cos[s];
                if (CheckBoxCostume.costumeSet - 1 == s)
                {
                    style3.normal = GUI.skin.button.active;
                }
                else
                {
                    style3.normal = GUI.skin.button.normal;
                }
                if (GUILayout.Button(de, style3))
                {
                    CheckBoxCostume.costumeSet = s + 1;
                }
            }
            GUILayout.EndHorizontal();
        }


        GUILayout.Label(CyanMod.INC.la("camera_type"));

        IN_GAME_MAIN_CAMERA.cameraMode = (CAMERA_TYPE)GUILayout.SelectionGrid((int)IN_GAME_MAIN_CAMERA.cameraMode, CameraType, 4);

        if (GUILayout.Button(INC.la("lets_go")))
        {
            if (isTitan == 0)
            {
                string selection = stat.name;
                NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[0], true);
                FengGameManagerMKII.instance.needChooseSide = false;
                if (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.PVP_CAPTURE)
                {
                    FengGameManagerMKII.instance.checkpoint = CyanMod.CachingsGM.Find("PVPchkPtH");
                }
                if (!PhotonNetwork.isMasterClient && (FengGameManagerMKII.instance.roundTime > 60f))
                {
                    if (FengGameManagerMKII.instance.heroes.Count != 0)
                    {
                        FengGameManagerMKII.instance.NOTSpawnPlayer(selection);
                    }
                    else
                    {
                        FengGameManagerMKII.instance.NOTSpawnPlayer(selection);
                        FengGameManagerMKII.instance.photonView.RPC("restartGameByClient", PhotonTargets.MasterClient, new object[0]);
                    }
                }
                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 (FengGameManagerMKII.instance.heroes.Count != 0)
                    {
                        FengGameManagerMKII.instance.NOTSpawnPlayer(selection);
                        FengGameManagerMKII.instance.photonView.RPC("restartGameByClient", PhotonTargets.MasterClient, new object[0]);
                    }
                    else
                    {
                        FengGameManagerMKII.instance.SpawnPlayer(selection, "playerRespawn");
                    }
                }
                else
                {
                    FengGameManagerMKII.instance.SpawnPlayer(selection, "playerRespawn");
                }
                NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[1], false);
                NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[2], false);
                instance.enabled = false;

                IN_GAME_MAIN_CAMERA.usingTitan = false;
                IN_GAME_MAIN_CAMERA.instance.setHUDposition();
                PhotonNetwork.player.character = selection;
            }
            else
            {
                if (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.PVP_AHSS)
                {
                    id = "AHSS";
                    NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[0], true);
                    FengGameManagerMKII.instance.needChooseSide = false;
                    if (!PhotonNetwork.isMasterClient && (FengGameManagerMKII.instance.roundTime > 60f))
                    {
                        FengGameManagerMKII.instance.NOTSpawnPlayer(id);
                        FengGameManagerMKII.instance.photonView.RPC("restartGameByClient", PhotonTargets.MasterClient, new object[0]);
                    }
                    else
                    {
                        FengGameManagerMKII.instance.SpawnPlayer(id, "playerRespawn2");
                    }
                    NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[1], false);
                    NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[2], false);
                    instance.enabled = false;
                    IN_GAME_MAIN_CAMERA.usingTitan = false;
                    IN_GAME_MAIN_CAMERA.instance.setHUDposition();

                    PhotonNetwork.player.character = id;
                }
                else
                {
                    if (IN_GAME_MAIN_CAMERA.gamemode == GAMEMODE.PVP_CAPTURE)
                    {
                        FengGameManagerMKII.instance.checkpoint = CyanMod.CachingsGM.Find("PVPchkPtT");
                    }
                    string selection = "RANDOM";
                    NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[0], true);
                    if ((!PhotonNetwork.isMasterClient && (FengGameManagerMKII.instance.roundTime > 60f)) || FengGameManagerMKII.instance.justSuicide)
                    {
                        FengGameManagerMKII.instance.justSuicide = false;
                        FengGameManagerMKII.instance.NOTSpawnNonAITitan(selection);
                    }
                    else
                    {
                        FengGameManagerMKII.instance.SpawnNonAITitan2(selection, "titanRespawn");
                    }
                    FengGameManagerMKII.instance.needChooseSide = false;
                    NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[1], false);
                    NGUITools.SetActive(FengGameManagerMKII.instance.uiT.panels[2], false);
                    instance.enabled = false;
                    IN_GAME_MAIN_CAMERA.usingTitan = true;
                    IN_GAME_MAIN_CAMERA.instance.setHUDposition();
                }
            }
            FengGameManagerMKII.instance.saves();
        }
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Beispiel #14
0
    public void SpawnPlayerAt(string id, string find = "")
    {
        if (!CustomLevel.logicLoaded || !CustomLevel.customLevelLoaded)
        {
            NotSpawnPlayer(id);
            return;
        }

        myLastRespawnTag = find;
        Vector3 pos;
        var     rot = Quaternion.identity;

        if (find != string.Empty)
        {
            var positions = GameObject.FindGameObjectsWithTag(find);
            if (positions.Length > 0)
            {
                pos = positions[Random.Range(0, positions.Length)].transform.position;
            }
            else
            {
                pos = RespawnPositions.RandomHeroPos;
            }
        }
        else if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
        {
            pos = checkpoint.transform.position;
        }
        else if (RCManager.racingSpawnPointSet)
        {
            pos = RCManager.racingSpawnPoint;
            rot = RCManager.racingSpawnPointRotation;
        }
        else if (Level.Name.StartsWith("Custom"))
        {
            var list = new List <Vector3>();
            switch (PhotonNetwork.player.RCteam)
            {
            case 0:
                for (var i = 0; i < 2; i++)
                {
                    var type = i == 0 ? "C" : "M";
                    foreach (var vec in CustomLevel.spawnPositions["Player" + type])
                    {
                        list.Add(vec);
                    }
                }

                break;

            case 1:
                using (var enumerator = CustomLevel.spawnPositions["PlayerC"].GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        var vec2 = enumerator.Current;
                        list.Add(vec2);
                    }
                }

                break;

            case 2:
                using (var enumerator = CustomLevel.spawnPositions["PlayerM"].GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        var vec2 = enumerator.Current;
                        list.Add(vec2);
                    }
                }

                break;

            default:
                foreach (var vec3 in CustomLevel.spawnPositions["PlayerM"])
                {
                    list.Add(vec3);
                }

                break;
            }

            if (list.Count > 0)
            {
                pos = list[Random.Range(0, list.Count)];
            }
            else
            {
                pos = RespawnPositions.RandomHeroPos;
            }
        }
        else
        {
            pos = RespawnPositions.RandomHeroPos;
        }

        var component = IN_GAME_MAIN_CAMERA.MainCamera;

        myLastHero = id.ToUpper();
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single)
        {
            if (IN_GAME_MAIN_CAMERA.singleCharacter == "TITAN_EREN")
            {
                component.SetMainObject(
                    ((GameObject)Instantiate(CacheResources.Load("TITAN_EREN"), pos, Quaternion.identity))
                    .GetComponent <TITAN_EREN>());
            }
            else
            {
                component.SetMainObject(((GameObject)Instantiate(CacheResources.Load("AOTTG_HERO 1"), pos, rot))
                                        .GetComponent <HERO>());
                if (IN_GAME_MAIN_CAMERA.singleCharacter == "SET 1" || IN_GAME_MAIN_CAMERA.singleCharacter == "SET 2" ||
                    IN_GAME_MAIN_CAMERA.singleCharacter == "SET 3")
                {
                    var heroCostume = CostumeConeveter.LocalDataToHeroCostume(IN_GAME_MAIN_CAMERA.singleCharacter);
                    heroCostume.Checkstat();
                    CostumeConeveter.HeroCostumeToLocalData(heroCostume, IN_GAME_MAIN_CAMERA.singleCharacter);
                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();

                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = heroCostume;
                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat = heroCostume.stat;

                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                    IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                    IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
                }
                else
                {
                    for (var i = 0; i < HeroCostume.costume.Length; i++)
                    {
                        if (HeroCostume.costume[i].name.ToUpper() == IN_GAME_MAIN_CAMERA.singleCharacter.ToUpper())
                        {
                            var num = HeroCostume.costume[i].id + CheckBoxCostume.costumeSet - 1;
                            if (HeroCostume.costume[num].name != HeroCostume.costume[i].name)
                            {
                                num = HeroCostume.costume[i].id + 1;
                            }

                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();
                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = HeroCostume.costume[num];
                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat =
                                HeroStat.getInfo(HeroCostume.costume[num].name.ToUpper());
                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                            IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                            IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
                            break;
                        }
                    }
                }
            }
        }
        else
        {
            var hero = Pool.NetworkEnable("AOTTG_HERO 1", pos, Quaternion.identity).GetComponent <HERO>();
            component.SetMainObject(hero);
            id = id.ToUpper();
            if (id == "SET 1" || id == "SET 2" || id == "SET 3")
            {
                var heroCostume2 = CostumeConeveter.LocalDataToHeroCostume(id);
                heroCostume2.Checkstat();
                CostumeConeveter.HeroCostumeToLocalData(heroCostume2, id);
                IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();

                IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = heroCostume2;
                IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat = heroCostume2.stat;

                IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
            }
            else
            {
                for (var j = 0; j < HeroCostume.costume.Length; j++)
                {
                    if (HeroCostume.costume[j].name.ToUpper() == id.ToUpper())
                    {
                        var num2 = HeroCostume.costume[j].id;
                        if (id.ToUpper() != "AHSS")
                        {
                            num2 += CheckBoxCostume.costumeSet - 1;
                        }

                        if (HeroCostume.costume[num2].name != HeroCostume.costume[j].name)
                        {
                            num2 = HeroCostume.costume[j].id + 1;
                        }

                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = HeroCostume.costume[num2];
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat =
                            HeroStat.getInfo(HeroCostume.costume[num2].name.ToUpper());
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                        IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                        IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
                        break;
                    }
                }
            }

            CostumeConeveter.HeroCostumeToPhotonData(IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume,
                                                     PhotonNetwork.player);
            if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
            {
                IN_GAME_MAIN_CAMERA.MainT.position += new Vector3(Random.Range(-20, 20), 2f, Random.Range(-20, 20));
            }

            PhotonNetwork.player.Dead    = false;
            PhotonNetwork.player.IsTitan = false;
        }

        component.enabled = true;

        IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition();
        IN_GAME_MAIN_CAMERA.SpecMov.disable = true;
        IN_GAME_MAIN_CAMERA.Look.disable    = true;
        component.gameOver = false;
        Screen.lockCursor  = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS;
        Screen.showCursor  = false;
        ShowHUDInfoCenter(string.Empty);
    }
Beispiel #15
0
        protected override void DrawMainPart()
        {
            left.Reset();
            LabelCenter(left, locale["character"], true);
            SelectionGrid(left, costumeSelection, costumeList, 3, true);
            bool updateChar = avatar == null;
            int  oldChar    = characterSelection.Value;

            SelectionGrid(left, characterSelection, characterList, 1, true);
            if (oldChar != characterSelection.Value)
            {
                updateChar = true;
            }
            character = charactersList[characterSelection].ToUpper();
            var set = CostumeConeveter.LocalDataToHeroCostume(character);

            stats = character.Contains("SET") ? (set == null ? new HeroStat() : set.stat) : HeroStat.getInfo(character);

            LabelCenter(left, locale["camera"], true);
            SelectionGrid(left, Settings.CameraMode, cameraList, cameraList.Length, true);
            float height = Style.Height * (FengGameManagerMKII.Level.PVPEnabled ? 3f : 2f) + (Style.VerticalMargin * (FengGameManagerMKII.Level.PVPEnabled ? 2f : 1f)) + (Style.Height + Style.VerticalMargin);

            left.MoveToEndY(BoxPosition, height);
            if (Button(left, locale["humanStart"], true))
            {
                SpawnHero();
                DisableImmediate();
                return;
            }
            if (FengGameManagerMKII.Level.PVPEnabled)
            {
                if (FengGameManagerMKII.Level.TeamTitan && IN_GAME_MAIN_CAMERA.GameMode != GameMode.PVP_AHSS)
                {
                    if (Button(left, locale["titanStart"], true))
                    {
                        SpawnTitan();
                        DisableImmediate();
                        return;
                    }
                }
                else
                {
                    if (Button(left, locale["ahssStart"], true))
                    {
                        SpawnAHSS();
                        DisableImmediate();
                        return;
                    }
                }
            }
            if (Button(left, locale["back"], true))
            {
                Screen.lockCursor = true;
                Screen.showCursor = true;
                IN_GAME_MAIN_CAMERA.SpecMov.disable = false;
                IN_GAME_MAIN_CAMERA.Look.disable    = false;
                Disable();
                return;
            }
            right.Reset();
            LabelCenter(right, locale["avatar"], true);
            right.height = right.width;
            if (updateChar)
            {
                avatar = LoadTexture(character.Contains("SET") ? "CUSTOM" : character, "png");
            }
            DrawTexture(right, avatar, true);
            right.height = Style.Height;
            LabelCenter(right, locale["stats"], true);
            Label(right, locale.Format("speed", stats.Spd.ToString()), true);
            Label(right, locale.Format("acceleration", stats.Acl.ToString()), true);
            Label(right, locale.Format("gas", stats.Gas.ToString()), true);
            Label(right, locale.Format("blade", stats.Bla.ToString()), true);
        }