Пример #1
0
 public static AudioClip GetSoundByName(string _name)
 {
     foreach (AudioClip current in SND.soundlist)
     {
         if (current.name == _name)
         {
             AudioClip result = current;
             return(result);
         }
     }
     SND.curSound = null;
     string[] array = _name.Split(new char[]
     {
         '/'
     });
     if (array.Length > 1)
     {
         SND.curSound = ContentLoader_.LoadAudio(array[array.Length - 1]);
     }
     else
     {
         SND.curSound = ContentLoader_.LoadAudio(_name);
     }
     if (SND.curSound == null)
     {
         return(null);
     }
     SND.soundlist.Add(SND.curSound);
     return(SND.curSound);
 }
Пример #2
0
    public static void CreateWeapon(int wid, int bwid)
    {
        GameObject gameObject = ContentLoader_.LoadGameObject("p_" + MenuShop.shopdata[wid].name2);

        if (gameObject != null)
        {
            GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity) as GameObject;
            GameObject gameObject3 = GameObject.Find(MenuPlayer.goPlayer.name + "/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1/Bip001 R Clavicle/Bip001 R UpperArm/Bip001 R Forearm/Bip001 R Hand");
            gameObject2.transform.parent        = gameObject3.transform;
            gameObject2.transform.localPosition = gameObject.transform.localPosition;
            gameObject2.transform.localRotation = gameObject.transform.localRotation;
            if (MenuShop.currData != null && MenuShop.currData.section == 5 && wid >= 1 && wid <= 25)
            {
                Component[] componentsInChildren = gameObject2.GetComponentsInChildren(typeof(Renderer));
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    Renderer renderer = (Renderer)componentsInChildren[i];
                    renderer.materials[0].SetTexture(0, TEX.GetTextureByName(MenuShop.currData.iconname));
                }
            }
        }
        GameObject gameObject4 = ContentLoader_.LoadGameObject("b_" + MenuShop.shopdata[bwid].name2);

        if (gameObject != null)
        {
            GameObject gameObject5 = UnityEngine.Object.Instantiate(gameObject4, Vector3.zero, Quaternion.identity) as GameObject;
            GameObject gameObject6 = GameObject.Find(MenuPlayer.goPlayer.name + "/Bip001/Bip001 Pelvis/Bip001 Spine/Bip001 Spine1");
            gameObject5.transform.parent        = gameObject6.transform;
            gameObject5.transform.localPosition = gameObject4.transform.localPosition;
            gameObject5.transform.localRotation = gameObject4.transform.localRotation;
        }
    }
Пример #3
0
    public static GameObject Create(string name)
    {
        GameObject gameObject = ContentLoader_.LoadGameObject(name);

        if (gameObject == null)
        {
            MonoBehaviour.print("not founded " + name);
            return(null);
        }
        return(UnityEngine.Object.Instantiate(gameObject, gameObject.transform.position, gameObject.transform.rotation) as GameObject);
    }
Пример #4
0
 private void Update()
 {
     if (this.handletime != 0f && Time.time > this.handletime)
     {
         this.handle = GameObject.Find(base.gameObject.name + "/handle");
         this.handle.transform.SetParent(null);
         this.handle.GetComponent <Rigidbody>().isKinematic = false;
         this.handle.GetComponent <Rigidbody>().AddForce(base.gameObject.GetComponent <Rigidbody>().velocity + Camera.main.transform.right * 75f);
         this.handle.GetComponent <Rigidbody>().AddTorque(this.handle.transform.forward * 500f);
         this.handletime = 0f;
     }
     if (this.explodetime != 0f && Time.time > this.explodetime)
     {
         GameObject original = ContentLoader_.LoadGameObject("Detonator");
         UnityEngine.Object.Instantiate(original, base.gameObject.transform.position + Vector3.up * 0.1f, base.gameObject.transform.rotation);
         this.explodetime = 0f;
         if (this.handle)
         {
             UnityEngine.Object.Destroy(this.handle);
         }
         UnityEngine.Object.Destroy(base.gameObject);
         if (base.gameObject.GetComponent <BaseEnt>().ownerid == Client.ID)
         {
             Client.cs.send_ent_destroy(this.uid, base.gameObject.GetComponent <BaseEnt>().type, base.gameObject.transform.position);
         }
         if (vp_FPController.cs == null || vp_FPCamera.cs == null)
         {
             return;
         }
         float num = Vector3.Distance(vp_FPController.cs.SmoothPosition, base.gameObject.transform.position);
         if (num > 20f)
         {
             return;
         }
         float num2 = 0.001f;
         if (num < 5f)
         {
             num2 = 0.005f;
         }
         else if (num < 10f)
         {
             num2 = 0.003f;
         }
         num = 20f - num;
         vp_FPCamera.cs.AddForce2(new Vector3(2f, -10f, 2f) * num * num2);
         if (UnityEngine.Random.value > 0.5f)
         {
             num2 = -num2;
         }
         vp_FPCamera.cs.AddRollForce(num2 * 200f);
     }
 }
Пример #5
0
 private void LoadEnd()
 {
     GUIM.fontlist[0] = ContentLoader_.LoadFont("Play-Regular");
     GUIM.fontlist[1] = ContentLoader_.LoadFont("Play-Bold");
     GUIM.tDebug      = TEX.GetTextureByName("red");
     GUIM.tBar[0]     = TEX.GetTextureByName("tr");
     GUIM.tBar[1]     = TEX.GetTextureByName("scroll_middle");
     GUIM.tBar[2]     = TEX.GetTextureByName("tr");
     GUIM.tBar[3]     = TEX.GetTextureByName("slider_normal");
     GUIM.tBar[4]     = TEX.GetTextureByName("slider_active");
     GUIM.tBar[5]     = TEX.GetTextureByName("slider_back");
     GUIM.tButton     = TEX.GetTextureByName("button");
 }
Пример #6
0
    private void LoadEnd()
    {
        GameObject gameObject = GameObject.Find("Camera");

        if (gameObject && gameObject.GetComponent <AudioSource>())
        {
            gameObject.GetComponent <AudioSource>().clip = ContentLoader_.LoadAudio("maintheme");
            gameObject.GetComponent <AudioSource>().Play();
            gameObject.GetComponent <AudioSource>().volume = Options.menuvol;
        }
        Main.tVig = TEX.GetTextureByName("vig");
        MonoBehaviour.print("MAIN.LOADEND");
    }
Пример #7
0
 public void PostAwake()
 {
     C4.checkTime       = Time.realtimeSinceStartup;
     C4.trPlayer        = GameObject.Find("LocalPlayer").transform;
     C4.placeBomb       = ContentLoader_.LoadGameObject("c4_place");
     C4.plantStartSound = SND.GetSoundByName("c4_plant");
     C4.showDiffuseBar  = false;
     C4.sector          = new C4.PlantSector[2];
     C4.plant           = new List <C4.PlantSector> [2];
     C4.plant[0]        = new List <C4.PlantSector>();
     C4.plant[1]        = new List <C4.PlantSector>();
     this.csCamera      = (vp_FPCamera)UnityEngine.Object.FindObjectOfType(typeof(vp_FPCamera));
     this.csController  = (vp_FPController)UnityEngine.Object.FindObjectOfType(typeof(vp_FPController));
 }
Пример #8
0
    public static Material DefaultGlowMaterial()
    {
        if (Detonator.defaultGlowMaterial != null)
        {
            return(Detonator.defaultGlowMaterial);
        }
        Detonator.defaultGlowMaterial      = new Material(Shader.Find("Particles/Additive"));
        Detonator.defaultGlowMaterial.name = "Glow-Default";
        Texture2D mainTexture = ContentLoader_.LoadTexture("Glow") as Texture2D;

        Detonator.defaultGlowMaterial.SetColor("_TintColor", Color.white);
        Detonator.defaultGlowMaterial.mainTexture = mainTexture;
        return(Detonator.defaultGlowMaterial);
    }
Пример #9
0
    public static Material DefaultShockwaveMaterial()
    {
        if (Detonator.defaultShockwaveMaterial != null)
        {
            return(Detonator.defaultShockwaveMaterial);
        }
        Detonator.defaultShockwaveMaterial      = new Material(Shader.Find("Particles/Additive"));
        Detonator.defaultShockwaveMaterial.name = "Shockwave-Default";
        Texture2D mainTexture = ContentLoader_.LoadTexture("Shockwave") as Texture2D;

        Detonator.defaultShockwaveMaterial.SetColor("_TintColor", new Color(0.1f, 0.1f, 0.1f, 1f));
        Detonator.defaultShockwaveMaterial.mainTexture = mainTexture;
        return(Detonator.defaultShockwaveMaterial);
    }
Пример #10
0
 public static void Init()
 {
     GUI2.colorlist[0] = new Color(0f, 0f, 0f, 1f);
     GUI2.colorlist[1] = new Color(1f, 1f, 1f, 1f);
     GUI2.colorlist[3] = new Color(0.25f, 1f, 0.25f, 1f);
     GUI2.colorlist[2] = new Color(1f, 0.2f, 0f, 1f);
     GUI2.colorlist[4] = new Color(0f, 0.5f, 1f, 1f);
     GUI2.colorlist[5] = new Color(1f, 0.2f, 0f, 1f);
     GUI2.colorlist[6] = new Color(1f, 1f, 0f, 1f);
     GUI2.colorlist[7] = new Color(0.5f, 0.5f, 0.5f, 1f);
     GUI2.fontlist[0]  = ContentLoader_.LoadFont("Archangelsk");
     GUI2.fontlist[1]  = ContentLoader_.LoadFont("Kelson Sans Regular RU");
     GUI2.fontlist[2]  = ContentLoader_.LoadFont("Kelson Sans Bold RU");
 }
Пример #11
0
 public void PostAwake()
 {
     HUD.cs                  = this;
     this.tBlack             = TEX.GetTextureByName("black");
     this.tGray0             = TEX.GetTextureByName("gray0");
     this.tWhite             = TEX.GetTextureByName("white");
     this.tYellow            = TEX.GetTextureByName("yellow");
     this.tHealthIcon        = TEX.GetTextureByName("GUI/health_icon");
     this.tArmorIcon         = TEX.GetTextureByName("GUI/armor_icon");
     this.tAmmoIcon          = TEX.GetTextureByName("GUI/ammo_icon");
     this.tFGIconOrange      = TEX.GetTextureByName("GUI/fg_orange");
     this.tFGIconGray        = TEX.GetTextureByName("GUI/fg_gray");
     this.tFGIconWhite       = TEX.GetTextureByName("GUI/fg_white");
     this.tFBIconOrange      = TEX.GetTextureByName("GUI/fb_orange");
     this.tFBIconGray        = TEX.GetTextureByName("GUI/fb_gray");
     this.tFBIconWhite       = TEX.GetTextureByName("GUI/fb_white");
     this.tSGIconOrange      = TEX.GetTextureByName("GUI/sg_orange");
     this.tSGIconGray        = TEX.GetTextureByName("GUI/sg_gray");
     this.tSGIconWhite       = TEX.GetTextureByName("GUI/sg_white");
     this.tBombIconNormal    = TEX.GetTextureByName("GUI/c4_orange");
     this.tBombIconActive    = TEX.GetTextureByName("GUI/c4_red");
     this.tDiffuseIconNormal = TEX.GetTextureByName("GUI/defuse_orange");
     this.tDiffuseIconActive = TEX.GetTextureByName("GUI/defuse_red");
     this.tGradientLeft      = TEX.GetTextureByName("GUI/left_gradient");
     this.tGradientRight     = TEX.GetTextureByName("GUI/right_gradient");
     this.tAmmoIcon          = TEX.GetTextureByName("GUI/bullets_icon");
     this.tMoneyIcon         = TEX.GetTextureByName("GUI/money_icon");
     this.tRed               = TEX.GetTextureByName("red");
     this.tBlue              = TEX.GetTextureByName("blue");
     this.OnResize();
     HUD.sHealth      = "-";
     HUD.sArmor       = "-";
     HUD.sMoney       = "0";
     HUD.Money        = 0;
     HUD.bombState    = 0;
     HUD.diffuseState = 0;
     HUD.show         = false;
     if (HUD.a == null)
     {
         HUD.a = base.gameObject.AddComponent <AudioSource>();
     }
     if (HUD.briefing == null)
     {
         HUD.briefing = ContentLoader_.LoadAudio("briefing");
     }
     if (HUD.champion == null)
     {
         HUD.champion = ContentLoader_.LoadAudio("champion");
     }
 }
Пример #12
0
 private void LoadEnd()
 {
     MenuPlayer.pgoPlayer = ContentLoader_.LoadGameObject("pwmplayer");
     if (MenuPlayer.pgoPlayer == null)
     {
         MonoBehaviour.print("MenuPlayer::pgoPlayer null");
     }
     if (!BaseData.Auth)
     {
         return;
     }
     Main.HideAll();
     MenuPlayer.SetActive(true);
 }
Пример #13
0
    public static Material DefaultFireballAMaterial()
    {
        if (Detonator.defaultFireballAMaterial != null)
        {
            return(Detonator.defaultFireballAMaterial);
        }
        Detonator.defaultFireballAMaterial      = new Material(Shader.Find("Particles/Additive"));
        Detonator.defaultFireballAMaterial.name = "FireballA-Default";
        Texture2D mainTexture = ContentLoader_.LoadTexture("Fireball") as Texture2D;

        Detonator.defaultFireballAMaterial.SetColor("_TintColor", Color.white);
        Detonator.defaultFireballAMaterial.mainTexture      = mainTexture;
        Detonator.defaultFireballAMaterial.mainTextureScale = new Vector2(0.5f, 1f);
        return(Detonator.defaultFireballAMaterial);
    }
Пример #14
0
    public static Material DefaultSmokeAMaterial()
    {
        if (Detonator.defaultSmokeAMaterial != null)
        {
            return(Detonator.defaultSmokeAMaterial);
        }
        Detonator.defaultSmokeAMaterial      = new Material(Shader.Find("Particles/Alpha Blended"));
        Detonator.defaultSmokeAMaterial.name = "SmokeA-Default";
        Texture2D mainTexture = ContentLoader_.LoadTexture("Smoke2") as Texture2D;

        Detonator.defaultSmokeAMaterial.SetColor("_TintColor", new Color(0.2f, 0.2f, 0.2f, 1f));
        Detonator.defaultSmokeAMaterial.mainTexture      = mainTexture;
        Detonator.defaultSmokeAMaterial.mainTextureScale = new Vector2(0.5f, 1f);
        return(Detonator.defaultSmokeAMaterial);
    }
Пример #15
0
    public static Material DefaultHeatwaveMaterial()
    {
        if (!SystemInfo.supportsImageEffects || Options.xGrenade <= 0)
        {
            return(null);
        }
        if (Detonator.defaultHeatwaveMaterial != null)
        {
            return(Detonator.defaultHeatwaveMaterial);
        }
        Detonator.defaultHeatwaveMaterial      = new Material(Shader.Find("HeatDistort"));
        Detonator.defaultHeatwaveMaterial.name = "Heatwave-Default";
        Texture2D texture = ContentLoader_.LoadTexture("Heatwave") as Texture2D;

        Detonator.defaultHeatwaveMaterial.SetTexture("_BumpMap", texture);
        return(Detonator.defaultHeatwaveMaterial);
    }
Пример #16
0
 public static void Init()
 {
     if (ContentLoader_.proceed)
     {
         ContentLoader_.BroadcastAll("LoadEnd", string.Empty);
         return;
     }
     ContentLoader_.materialList.Clear();
     ContentLoader_.gameobjectList.Clear();
     ContentLoader_.textureList.Clear();
     ContentLoader_.audioList.Clear();
     ContentLoader_.AddPack();
     if (ContentLoader_.LoadList.Count == 0)
     {
         ContentLoader_.BroadcastAll("LoadEnd", string.Empty);
         ContentLoader_.proceed = true;
         UnityEngine.Debug.Log("ContentLoader.Editor.LoadEnd");
     }
 }
Пример #17
0
    public static void CreateEnt(int ownerid, int classid, int uid, int type, Vector3 pos, Vector3 rot, Vector3 force, Vector3 torque)
    {
        if (type == 0 && EntControll.pgoEntFG == null)
        {
            return;
        }
        if (type == 1 && EntControll.pgoEntFB == null)
        {
            return;
        }
        if (type == 2 && EntControll.pgoEntSG == null)
        {
            return;
        }
        GameObject gameObject = null;

        if (type == 0)
        {
            gameObject = UnityEngine.Object.Instantiate <GameObject>(EntControll.pgoEntFG);
        }
        if (type == 1)
        {
            gameObject = UnityEngine.Object.Instantiate <GameObject>(EntControll.pgoEntFB);
        }
        if (type == 2)
        {
            gameObject = UnityEngine.Object.Instantiate <GameObject>(EntControll.pgoEntSG);
        }
        gameObject.transform.position    = pos;
        gameObject.transform.eulerAngles = rot;
        gameObject.name = "ent_" + uid.ToString();
        gameObject.GetComponent <Rigidbody>().AddForce(force);
        gameObject.GetComponent <Rigidbody>().AddTorque(torque);
        gameObject.GetComponent <BaseEnt>().uid     = uid;
        gameObject.GetComponent <BaseEnt>().ownerid = ownerid;
        gameObject.GetComponent <BaseEnt>().type    = type;
        if (ScoreBoard.gamemode == 3)
        {
            MeshRenderer component = gameObject.GetComponent <MeshRenderer>();
            ContentLoader_.ReplaceMaterialsFromRes(ref component);
        }
    }
Пример #18
0
 public static Texture2D GetTextureByName(string _name)
 {
     foreach (Texture2D current in TEX.texlist)
     {
         if (current.name == _name)
         {
             return(current);
         }
     }
     TEX.curTex = null;
     string[] array = _name.Split(new char[]
     {
         '/'
     });
     if (array.Length > 1)
     {
         TEX.curTex = (ContentLoader_.LoadTexture(array[array.Length - 1]) as Texture2D);
     }
     else
     {
         TEX.curTex = (ContentLoader_.LoadTexture(_name) as Texture2D);
     }
     return(TEX.curTex);
 }
Пример #19
0
    private void Awake()
    {
        RenderSettings.fog = false;
        switch (0)
        {
        case 0:
            GameData.gSteam = true;
            GameData.gVK    = false;
            break;

        case 1:
            GameData.gSteam  = false;
            GameData.gSocial = true;
            GameData.gVK     = true;
            break;

        case 2:
            GameData.gSteam  = false;
            GameData.gSocial = true;
            GameData.gFB     = true;
            break;
        }
        MonoBehaviour.print("MainManager::Awake");
        Application.runInBackground = true;
        TEX.Init();
        GUIM.Init();
        BaseData.Init();
        Lang.Init();
        ContentLoader_.Init();
        MenuShop.Init();
        if (GameData.gVK)
        {
        }
        base.gameObject.GetComponent <UDPClient>().PostAwake();
        base.gameObject.GetComponent <WebHandler>().PostAwake();
        base.gameObject.GetComponent <BaseData>().PostAwake();
        this.goGUI = GameObject.Find("GUI");
        UIManager.PostAwake();
        UIManager.SetCanvasActive(true);
        UIManager.SetLoadingActive(true);
        this.goGUI.GetComponent <Main>().PostAwake();
        this.goGUI.GetComponent <TopBar>().PostAwake();
        this.goGUI.GetComponent <BottomBar>().PostAwake();
        this.goGUI.GetComponent <Profile>().PostAwake();
        this.goGUI.GetComponent <MenuShop>().PostAwake();
        this.goGUI.GetComponent <MenuPlayer>().PostAwake();
        this.goGUI.GetComponent <MenuGold>().PostAwake();
        this.goGUI.GetComponent <MenuServers>().PostAwake();
        this.goGUI.GetComponent <MenuOptions>().PostAwake();
        this.goGUI.GetComponent <MenuInventory>().PostAwake();
        this.goGUI.GetComponent <MainMenuConsole>().PostAwake();
        GameObject.Find("UI").GetComponent <UIManager>().DebugText.text = string.Empty;
        Debug.Log("StartAuth");
        bool flag = false;

        if (GameData.gSocial && !flag)
        {
            BaseData.StartAuth();
        }
        if (GameData.gVK && flag)
        {
            BaseData.uid     = "7320897";
            BaseData.key     = "3eeaed79cbe63bb1cb6d977753b1c048";
            BaseData.session = "_";
            WebHandler.get_profile("&version=" + Client.version);
        }
    }
Пример #20
0
 public static void Init()
 {
     EntControll.pgoEntFG = ContentLoader_.LoadGameObject("ent_fg");
     EntControll.pgoEntFB = ContentLoader_.LoadGameObject("ent_fb");
     EntControll.pgoEntSG = ContentLoader_.LoadGameObject("ent_sg");
 }
Пример #21
0
    public static void Explosion()
    {
        C4Place.isActive = false;
        if (C4Place.asBeep == null)
        {
            return;
        }
        float num;

        if (SpecCam.show)
        {
            if (SpecCam.FID >= 0 && SpecCam.mode == 1 && PlayerControll.Player[SpecCam.FID] != null)
            {
                num = Vector3.Distance(C4.bombGo.transform.position, PlayerControll.Player[SpecCam.FID].go.transform.position);
            }
            else
            {
                num = Vector3.Distance(C4.bombGo.transform.position, SpecCam.position);
            }
        }
        else
        {
            num = Vector3.Distance(C4.bombGo.transform.position, BasePlayer.go.transform.position);
        }
        if (num < 50f)
        {
            C4Place.asBeep.volume      = 0.5f * Options.gamevol;
            C4Place.asBeep.maxDistance = 55f;
            C4Place.asBeep.PlayOneShot(C4Place.detonationSound);
        }
        else
        {
            C4Place.asBeep.volume      = 1f * Options.gamevol;
            C4Place.asBeep.maxDistance = 999999f;
            C4Place.asBeep.PlayOneShot(C4Place.detonationFarSound);
        }
        GameObject original = ContentLoader_.LoadGameObject("Detonator");

        UnityEngine.Object.Instantiate(original, C4.bombGo.transform.position + Vector3.up * 0.1f, C4.bombGo.transform.rotation);
        if (vp_FPController.cs == null || vp_FPCamera.cs == null)
        {
            return;
        }
        float num2 = Vector3.Distance(vp_FPController.cs.SmoothPosition, C4.bombGo.transform.position);

        if (num2 > 30f)
        {
            return;
        }
        float num3 = 0.001f;

        if (num2 < 5f)
        {
            num3 = 0.005f;
        }
        else if (num2 < 10f)
        {
            num3 = 0.003f;
        }
        num2 = 30f - num2;
        vp_FPCamera.cs.AddForce2(new Vector3(2f, -10f, 2f) * num2 * num3);
        if (UnityEngine.Random.value > 0.5f)
        {
            num3 = -num3;
        }
        vp_FPCamera.cs.AddRollForce(num3 * 200f);
        C4.DestroyBomb();
    }
Пример #22
0
 public void Load(string svalue, int version)
 {
     base.StartCoroutine(ContentLoader_.cLoad(svalue, version));
     ContentLoader_.inDownload = true;
 }