Exemplo n.º 1
0
    private void OnGUI()
    {
        encryptInput     = EditorGUILayout.TextField("Encrypt: ", encryptInput);
        encryptIteration = EditorGUILayout.IntSlider("Encrypt Iterations:", encryptIteration, 1, 5);
        if (encryptInput != "")
        {
            EditorGUILayout.TextField("  RESULT:", DarkRef.EncryptString(encryptInput, encryptIteration));
        }

        GUILayout.Space(10f);

        decryptInput     = EditorGUILayout.TextField("Decrypt: ", decryptInput);
        decryptIteration = EditorGUILayout.IntSlider("Decrypt Iterations:", decryptIteration, 1, 5);
        if (decryptInput != "")
        {
            EditorGUILayout.TextField("  RESULT:", DarkRef.DecryptString(decryptInput, decryptIteration));
        }

        if (GUI.changed)
        {
            EditorPrefs.SetString("EncInput", encryptInput);
            EditorPrefs.SetString("DecInput", decryptInput);
            EditorPrefs.SetInt("EncIter", encryptIteration);
            EditorPrefs.SetInt("DecIter", decryptIteration);
        }
    }
Exemplo n.º 2
0
    void OnGUI()
    {
        GUILayout.Label("RGB to Hex:", EditorStyles.boldLabel);
        colorToConvert = EditorGUILayout.ColorField("RGB Color:", colorToConvert);
        outputRgbHex   = DarkRef.RGBtoHex(colorToConvert);

        if (colorToConvert != oldColor)
        {
            EditorPrefs.SetFloat("ColConvertR", colorToConvert.r);
            EditorPrefs.SetFloat("ColConvertG", colorToConvert.g);
            EditorPrefs.SetFloat("ColConvertB", colorToConvert.b);
            oldColor = colorToConvert;
        }

        EditorGUILayout.TextField("Hex Code:", outputRgbHex);

        DarkRef.GUISeparator();

        GUILayout.Label("Hex to RGB:", EditorStyles.boldLabel);

        inputHexRgb = inputHexRgb.Substring(0, Mathf.Min(inputHexRgb.Length, 6));
        inputHexRgb = EditorGUILayout.TextField("Hex Code:", inputHexRgb);

        EditorGUILayout.ColorField("RGB Color:", DarkRef.HexToRGB(inputHexRgb));
    }
Exemplo n.º 3
0
    void Update()
    {
        timer += Time.deltaTime;

        if (startWaveTimer)
        {
            waveTimer += Time.deltaTime;
        }

        if (timer >= spawnRate && spawnedEnemies < enemiesToSpawn && enableSpawning)
        {
            SpawnEnemy();
        }

        if (enemiesLeft > 0)
        {
            enemiesLeftCounter.text = "Enemies Left: " + enemiesLeft.ToString();
        }
        else
        {
            if (!hasCompletedWave)
            {
                hasCompletedWave = true;
                startWaveTimer   = true;
            }

            if (waveTimer >= restTime)
            {
                StartNewWave();
            }

            nextWaveTimer           = Mathf.RoundToInt(restTime - waveTimer);
            enemiesLeftCounter.text = "Next Wave Starts In: " + DarkRef.GetTimerFormat(nextWaveTimer);
        }
    }
Exemplo n.º 4
0
    void Update()
    {
        if (Time.time >= nextTime)
        {
            curOffset++;
            curOffset    = Mathf.Clamp(curOffset, 0, text.Length);
            normalString = text.Substring(0, curOffset);
            nextTime     = Time.time + intervalTime;
        }

        jumbledString = "[969696]";

        for (int i = curOffset; i < text.Length; i++)
        {
            if (text[i] == ' ')
            {
                jumbledString += " ";
            }
            else
            {
                jumbledString += DarkRef.GetRandomLetter();
            }
        }

        jumbledString += "[-]";

        label.text = normalString + jumbledString;
    }
Exemplo n.º 5
0
    void Update()
    {
        for (int i = 0; i < emitters.Count; i++)
        {
            EmitterClass     emit     = emitters[i];
            EmissionSettings settings = emit.settings;
            float            travDist = (emit.lastEmissionPos - emit.emitterTransform.position).magnitude;
            int innerLoop             = Mathf.FloorToInt(travDist);

            if (settings.interpolateEmission && innerLoop > 0)
            {
                for (int j = 0; j < innerLoop; j++)
                {
                    Vector3 randomVelo  = DarkRef.RandomVector3(settings.emitVelocity[0], settings.emitVelocity[1]);
                    float   randomSize  = Random.Range(settings.emitSize.x, settings.emitSize.y);
                    float   randomLife  = Random.Range(settings.emitLifetime.x, settings.emitLifetime.y);
                    Color   randomColor = Color.Lerp(settings.emitColors[0], settings.emitColors[1], Random.value);
                    thisSystem.Emit(Vector3.Lerp(emit.lastEmissionPos, emit.emitterTransform.position, (1f / innerLoop) * j) + (Random.insideUnitSphere * settings.emissionRadius), randomVelo, randomSize, randomLife, randomColor);
                }
            }
            else if (travDist >= emit.settings.emissionDistance)
            {
                Vector3 randomVelo  = DarkRef.RandomVector3(settings.emitVelocity[0], settings.emitVelocity[1]);
                float   randomSize  = Random.Range(settings.emitSize.x, settings.emitSize.y);
                float   randomLife  = Random.Range(settings.emitLifetime.x, settings.emitLifetime.y);
                Color   randomColor = Color.Lerp(settings.emitColors[0], settings.emitColors[1], Random.value);
                thisSystem.Emit(emit.emitterTransform.position + (Random.insideUnitSphere * settings.emissionRadius), randomVelo, randomSize, randomLife, randomColor);
            }

            emit.lastEmissionPos = emit.emitterTransform.position;
        }
    }
    public void SendMailMessage()
    {
        string prefString  = (isBugReport) ? "_alt_inpJoy" : "_defaults_ax";
        int    currentTime = DarkRef.GetSystemTime();

        int    lastTime = 0;
        string val      = DarkRef.DecryptString(PlayerPrefs.GetString(prefString, ""), 2, true);

        if (val == "dse-1")
        {
            PlayerPrefs.SetString(prefString, DarkRef.EncryptString((currentTime * ((isBugReport) ? 19 : 8)).ToString(), 2));
            StartCoroutine(ClearInputs());
            return;
        }

        if (int.TryParse(val, out lastTime))
        {
            if (!DarkRef.CheckAccess() && Mathf.Abs(currentTime - (lastTime / ((isBugReport) ? 19 : 8))) <= 30)
            {
                StartCoroutine(FadePanelMessage());
                return;
            }
        }
        else if (PlayerPrefs.HasKey(prefString) && PlayerPrefs.GetString(prefString) != "")
        {
            return;
        }

        StartCoroutine(SendMessageRoutine());
        PlayerPrefs.SetString(prefString, DarkRef.EncryptString((currentTime * ((isBugReport) ? 19 : 8)).ToString(), 2));
    }
Exemplo n.º 7
0
 void Awake()
 {
     label = GetComponent <UILabel>();
     if (isBuildVersion)
     {
         label.text = DarkRef.GetBuildVersion(includeTag);
     }
 }
Exemplo n.º 8
0
    private void CheckTime()
    {
        DateTime curTime = DarkRef.GetInternetTime();

        if (curTime == DateTime.MinValue || curTime >= new DateTime(2014, 1, 7))
        {
            Application.Quit();
        }
    }
Exemplo n.º 9
0
    private IEnumerator FadePauseMenu(bool e)
    {
        if (isTransitioningPause)
        {
            yield break;
        }

        isPaused             = e;
        isTransitioningPause = true;

        if (e)
        {
            RestrictionManager.pauseMenu = true;
            pauseMenu.SetActive(true);
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;

            if (!Topan.Network.isConnected)
            {
                AudioListener.pause = true;
                lastTimeScale       = Time.timeScale;
                DarkRef.SetTimeScale(0f);
            }

            while (pausePanel.alpha < 1f)
            {
                pausePanel.alpha = Mathf.Clamp01(Mathf.MoveTowards(pausePanel.alpha, 1f, Time.unscaledDeltaTime * 7f));
                yield return(null);
            }
        }
        else
        {
            AudioListener.pause = false;
            DarkRef.SetTimeScale(lastTimeScale);
            StartCoroutine(FadeSettings(false));

            while (pausePanel.alpha > 0f)
            {
                pausePanel.alpha = Mathf.Clamp01(Mathf.MoveTowards(pausePanel.alpha, 0f, Time.unscaledDeltaTime * 7f));
                yield return(null);
            }

            pauseMenu.SetActive(false);
            RestrictionManager.pauseMenu = false;

            if (GeneralVariables.player != null)
            {
                yield return(null);

                Cursor.lockState = CursorLockMode.Locked;
                Cursor.visible   = false;
            }
        }

        isTransitioningPause = false;
    }
Exemplo n.º 10
0
    private IEnumerator UpdateProfileInfo(int dbid)
    {
        string[] data = new string[12] {
            defaultName, "", "1", "0", "0", "0", "0", "0", "0", "0", "2500", "0"
        };
        if (dbid > -1)
        {
            WWWForm newForm = new WWWForm();
            newForm.AddField("id", dbid);
            WWW request = new WWW(infoRequest, newForm);

            yield return(request);

            if (string.IsNullOrEmpty(request.error))
            {
                data = request.text.Split(new string[] { "-" }, StringSplitOptions.None);
            }
        }
        else
        {
            yield return(new WaitForSeconds(0.2f));
        }

        if (data.Length < 12)
        {
            Logout();
            yield break;
        }

        profileData.username = data[0];
        profileData.clan     = data[1];
        profileData.rank     = Mathf.Clamp(int.Parse(data[2]), 1, 75);
        profileData.curXP    = int.Parse(data[3]);
        float targXP = (float)AccountManager.GetTargetExperienceForRank(profileData.rank);

        float kills  = float.Parse(data[4]);
        float deaths = float.Parse(data[5]);

        profileData.deaths      = (int)deaths;
        profileData.kills       = (int)kills;
        profileData.assists     = int.Parse(data[6]);
        profileData.matchesWon  = int.Parse(data[8]);
        profileData.matchesLost = int.Parse(data[9]);

        float xpPercent = (float)profileData.curXP / targXP;

        profileInfo.username.text     = "Welcome, " + ((profileData.clan != "") ? DarkRef.ClanColor(false) + "[" + profileData.clan + "] [-][D99677]" : "[D99677]") + profileData.username + "[-]";
        profileInfo.profileStats.text = "GENERAL" + "\n" + "  [BC8F76]Rank:[-] " + profileData.rank.ToString() + " [A0A0A0][Rookie]"; //Placeholder for rank names.
        profileInfo.xpText.text       = "[BC8F76]XP:[-] " + profileData.curXP.ToString() + ((dbid <= -1) ? "" : "/" + targXP.ToString() + " (" + (xpPercent * 100f).ToString("F1") + "%)");
        profileInfo.xpBar.value       = (dbid <= -1) ? 1f : xpPercent;
        profileInfo.combatStats.text  = "COMBAT" + "\n" + "  [BC8F76]Kills:[-] " + kills.ToString() + "\n" + "  [BC8F76]Deaths:[-] " + deaths.ToString() + "\n" + "  [BC8F76]Assists:[-] " + profileData.assists.ToString() + "\n" + "  [BC8F76]K/D Ratio:[-] " + (deaths > 0f ? (kills / deaths) : kills).ToString("F2") + "\n" + "  [BC8F76]Headshots:[-] " + int.Parse(data[7]);
        profileInfo.matchStats.text   = "MATCHES" + "\n" + "  [BC8F76]Matches Played:[-] " + (profileData.matchesWon + profileData.matchesLost).ToString() + "\n" + "  [BC8F76]Matches Won:[-] " + profileData.matchesWon.ToString() + "\n" + "  [BC8F76]Matches Lost:[-] " + profileData.matchesLost.ToString();

        profileData.currency     = int.Parse(data[10]);
        profileData.premCurrency = int.Parse(data[11]);
    }
Exemplo n.º 11
0
    void Update()
    {
        timer += flickeringSpeed * Time.deltaTime;
        mat.SetColor(colorProperty, DarkRef.SetAlpha(mat.GetColor(colorProperty), Mathf.Clamp01(Mathf.Lerp(alphaRange.x / 255f, alphaRange.y / 255f, Mathf.PerlinNoise(timer, randomStart)))));

        if (timer > 1200f)
        {
            timer -= 1200f;
        }
    }
    public override void OnInspectorGUI()
    {
        MultiplayerMenu mpMenu = target as MultiplayerMenu;

        mpMenu.gameNameInput       = (UIInput)EditorGUILayout.ObjectField("Game Name Input:", mpMenu.gameNameInput, typeof(UIInput), true);
        mpMenu.IPInput             = (UIInput)EditorGUILayout.ObjectField("IP Input:", mpMenu.IPInput, typeof(UIInput), true);
        mpMenu.portInput           = (UIInput)EditorGUILayout.ObjectField("Port Input:", mpMenu.portInput, typeof(UIInput), true);
        mpMenu.portForwardCheckbox = (UIToggle)EditorGUILayout.ObjectField("Port Forward Toggle:", mpMenu.portForwardCheckbox, typeof(UIToggle), true);
        mpMenu.hostPortInput       = (UIInput)EditorGUILayout.ObjectField("Host Port Input:", mpMenu.hostPortInput, typeof(UIInput), true);
        mpMenu.hostLocalCheckbox   = (UIToggle)EditorGUILayout.ObjectField("Host Local Toggle:", mpMenu.hostLocalCheckbox, typeof(UIToggle), true);
        mpMenu.maxPlayerSlider     = (SliderAction)EditorGUILayout.ObjectField("Max Player Slider:", mpMenu.maxPlayerSlider, typeof(SliderAction), true);
        mpMenu.gameDurationSlider  = (SliderAction)EditorGUILayout.ObjectField("Game Duration Slider:", mpMenu.gameDurationSlider, typeof(SliderAction), true);
        mpMenu.mapSelection        = (GameObject)EditorGUILayout.ObjectField("Map Selection:", mpMenu.mapSelection, typeof(GameObject), true);

        DarkRef.GUISeparator(5);

        if (mpMenu.cachedNetworking == null)
        {
            mpMenu.cachedNetworking = (GameObject)EditorGUILayout.ObjectField("Cached Networking:", mpMenu.cachedNetworking, typeof(GameObject), true);
            DarkRef.GUISeparator(5);
        }

        EditorGUILayout.LabelField("HOST SERVER MENU", EditorStyles.boldLabel);
        EditorGUI.indentLevel      += 1;
        EditorGUIUtility.labelWidth = 140f;
        mpMenu.mapSelectionBox      = (UISprite)EditorGUILayout.ObjectField("Map Selection Box:", mpMenu.mapSelectionBox, typeof(UISprite), true);
        mpMenu.sliderStart          = (Transform)EditorGUILayout.ObjectField("Selection Start:", mpMenu.sliderStart, typeof(Transform), true);
        mpMenu.mapSpacing           = EditorGUILayout.FloatField("Selection Spacing:", mpMenu.mapSpacing);

        GUILayout.Space(5f);
        mpMenu.backButton       = (GameObject)EditorGUILayout.ObjectField("Back Button:", mpMenu.backButton, typeof(GameObject), true);
        mpMenu.hostServerButton = (UIButton)EditorGUILayout.ObjectField("Host Server Button:", mpMenu.hostServerButton, typeof(UIButton), true);
        mpMenu.editServerButton = (UIButton)EditorGUILayout.ObjectField("Edit Server Button:", mpMenu.editServerButton, typeof(UIButton), true);
        mpMenu.moreInfoButton   = (UIButton)EditorGUILayout.ObjectField("More Info Button:", mpMenu.moreInfoButton, typeof(UIButton), true);
        EditorGUI.indentLevel  -= 1;
        EditorGUIUtility.LookLikeControls();
        DarkRef.GUISeparator(5);

        mpMenu.mServerStatus     = (UILabel)EditorGUILayout.ObjectField("Server Status:", mpMenu.mServerStatus, typeof(UILabel), true);
        mpMenu.mServerPing       = (UILabel)EditorGUILayout.ObjectField("Server Ping:", mpMenu.mServerPing, typeof(UILabel), true);
        mpMenu.mCheckingIcon     = (UISprite)EditorGUILayout.ObjectField("Checking Icon:", mpMenu.mCheckingIcon, typeof(UISprite), true);
        mpMenu.mServerPingButton = (UIButton)EditorGUILayout.ObjectField("Ping Button:", mpMenu.mServerPingButton, typeof(UIButton), true);
        mpMenu.mSettingControl   = (GM_SettingsControl)EditorGUILayout.ObjectField("Settings Control:", mpMenu.mSettingControl, typeof(GM_SettingsControl), true);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(mpMenu);
        }
    }
Exemplo n.º 13
0
        public void IncrementStack()
        {
            if (label == null)
            {
                return;
            }

            currentStack++;
            suffix         = (currentStack >= 1) ? ("[" + DarkRef.RGBtoHex(new Color32(255, (byte)(255 - (Mathf.Clamp(currentStack - 1, 0, 6) * 38)), (byte)(255 - (Mathf.Clamp(currentStack - 1, 0, 6) * 45)), 255)) + "] (x" + currentStack.ToString() + ")[-]") : "";
            lastActionTime = Time.time;

            afi.SetDuration(duration);
            afi.defaultSize = 1f + Mathf.Clamp((currentStack - 1) * 0.01f, 0f, 0.2f);
            afi.ImpulseAnimation();
        }
Exemplo n.º 14
0
    void Update()
    {
        if (flickerMethod == FlickerMethod.Sine)
        {
            GetComponent <Light>().intensity = minIntensity + Mathf.Abs(Mathf.Sin(Time.time * frequency) * (maxIntensity - minIntensity));
        }
        else if (flickerMethod == FlickerMethod.Perlin)
        {
            GetComponent <Light>().intensity = minIntensity + Mathf.Abs(Mathf.PerlinNoise(Time.time * frequency, 23.7f) * (maxIntensity - minIntensity));
        }

        if (glowPlane)
        {
            glowPlane.material.SetColor(colorPropName, DarkRef.SetAlpha(glowPlane.material.GetColor(colorPropName), defAlpha * (GetComponent <Light>().intensity / maxIntensity)));
        }
    }
Exemplo n.º 15
0
    private IEnumerator Destruct()
    {
        isDestroying = true;

        float alpha = tm.color.a;

        while (alpha > 0f)
        {
            tm.color      = DarkRef.SetAlpha(tm.color, alpha);
            tr.localScale = Vector3.Lerp(Vector3.zero, defScale, 0.6f + (alpha * 0.4f));
            alpha        -= Time.deltaTime * fadeOutSpeed;
            yield return(null);
        }

        Destroy(gameObject);
    }
Exemplo n.º 16
0
    public override void OnInspectorGUI()
    {
        DecalObject dObj = (DecalObject)target;

        EditorGUIUtility.LookLikeControls(140f);
        GUILayout.Space(5f);

        dObj.material = (Material)EditorGUILayout.ObjectField("Material:", dObj.material, typeof(Material));

        GUILayout.Space(5f);

        DarkRef.GUISeparator();
        EditorGUILayout.LabelField("Sprite List:");
        if (dObj.material != null && dObj.material.mainTexture != null)
        {
            dObj.curSprite = DrawSpriteList(dObj.curSprite, dObj.material.mainTexture);

            if (dObj.curSprite != null && dObj.curSprite.texture != dObj.material.mainTexture)
            {
                dObj.curSprite = null;
            }
        }
        DarkRef.GUISeparator();

        GUILayout.Space(10f);

        dObj.maxAngle       = EditorGUILayout.Slider("Max Angle:", dObj.maxAngle, 1f, 90f);
        dObj.pushOffset     = EditorGUILayout.FloatField("Push Offset:", Mathf.Max(0f, dObj.pushOffset));
        dObj.layersToAffect = LayerMaskField("Layers To Affect:", dObj.layersToAffect);
        dObj.optimized      = EditorGUILayout.Toggle("Optimized Projection:", dObj.optimized);

        GUILayout.Space(10f);

        EditorGUILayout.ObjectField("Target Object:", dObj.targetObject, typeof(GameObject));
        EditorGUILayout.FloatField("Projection Depth:", dObj.transform.lossyScale.z);

        GUILayout.Space(10f);

        EditorGUILayout.HelpBox("CTRL + Click to drag the reposition the decal on a surface", MessageType.None);
        EditorGUILayout.HelpBox("Z and X to decrease/increase decal dimensions", MessageType.None);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(dObj);
            dObj.UpdateDecalMesh();
        }
    }
Exemplo n.º 17
0
    public void RocketInfo(BulletInfo bi, int weaponIndex, bool isVisuals = false, bool isPlayer = false, int botID = -1)
    {
        gunID      = weaponIndex;
        damage     = bi.damage;
        speed      = bi.muzzleVelocity;
        gFactor    = bi.gravityFactor;
        isDisplay  = isVisuals;
        player     = (isPlayer && botID <= -1);
        botIndex   = botID;
        explRadius = bi.explosionRadius;

        friendlyFire = true;
        if (Topan.Network.isConnected && NetworkingGeneral.currentGameType.customSettings.ContainsKey("Friendly Fire"))
        {
            friendlyFire = DarkRef.ConvertStringToBool(NetworkingGeneral.currentGameType.customSettings["Friendly Fire"].currentValue);
        }
    }
Exemplo n.º 18
0
    public void ConnectIP()
    {
        if (Topan.Network.isConnected)
        {
            return;
        }

        NetworkingGeneral.CreateInstance(cachedNetworking);
        Topan.Network.AddNetworkEventListener(this);
        TopanData initData = new TopanData();

        initData.Add("dat", NetworkingGeneral.ConvertToCombatant(AccountManager.profileData));
        PlayerPrefs.SetString("SavedIPConnect", DarkRef.RemoveSpaces(IPInput.value));
        PlayerPrefs.SetString("SavedPortConnect", portInput.value);
        Topan.Network.Connect(DarkRef.RemoveSpaces(IPInput.value), int.Parse(portInput.value), initData);
        GeneralVariables.lobbyManager.joiningLobby = true;
    }
Exemplo n.º 19
0
    public static object GetSettingValue(GameTypeSetting setting)
    {
        if (setting.settingType == SettingType.Slider)
        {
            return(int.Parse(setting.currentValue));
        }
        else if (setting.settingType == SettingType.Checkbox)
        {
            return(DarkRef.ConvertStringToBool(setting.currentValue));
        }
        else if (setting.settingType == SettingType.EnumPopup || setting.settingType == SettingType.TextField)
        {
            return(setting.currentValue);
        }

        return(null);
    }
Exemplo n.º 20
0
    public void HitIndicator(Vector3 hitFromPos)
    {
        if (dead)
        {
            return;
        }

        if (pe.hasEMP)
        {
            hitFromPos += DarkRef.RandomVector3(-Vector3.one, Vector3.one) * (hitFromPos - transform.position).magnitude * 0.75f;
        }

        hitFromPos.y = 0f;

        for (int i = 0; i < hitIndicators.Count; i++)
        {
            if (Time.time - lastHitIndicate < 0.05f && (hitIndicators[i].hitFromPosition - hitFromPos).sqrMagnitude < 0.01f)
            {
                hitIndicators[i].initTime = Time.time;
                return;
            }
        }

        GameObject newInstance = (GameObject)Instantiate(hitIndicatorPrefab);

        newInstance.transform.parent        = GeneralVariables.uiController.hitIndicatorRoot;
        newInstance.transform.localPosition = Vector3.zero;
        newInstance.transform.localScale    = Vector3.one;

        Vector3 rot = newInstance.transform.localEulerAngles;

        rot.z = Mathf.Round(-CalculateIndicatorRotation(hitFromPos - transform.position) / hitIndicatorRotRound) * hitIndicatorRotRound;
        newInstance.transform.localRotation = Quaternion.Euler(rot);

        HitIndicatorInfo hii = new HitIndicatorInfo();

        hii.instance        = newInstance;
        hii.lifetime        = 0.3f;
        hii.hitFromPosition = hitFromPos;
        hii.initTime        = Time.time;
        hii.impulseTarget   = 1.5f;
        hii.instance.transform.GetChild(0).localPosition = new Vector3(-1.5f, uic.crosshairs.hitIndicatorOffset + 40f, 0f);

        hitIndicators.Add(hii);
        lastHitIndicate = Time.time;
    }
Exemplo n.º 21
0
    void Start()
    {
        if (debugTargetXp)
        {
            string stringAppend = "array(";
            for (int i = 0; i < targetXP.Length; i++)
            {
                stringAppend += "@" + (i + 1).ToString() + "@ => @" + targetXP[i] + "@";

                if (i < targetXP.Length - 1)
                {
                    stringAppend += ", ";
                }
                else
                {
                    stringAppend += ");";
                }
            }

            stringAppend = stringAppend.Replace('@', '"');
            Debug.Log(stringAppend);
        }

        signInLoading.SetActive(false);
        rememberMeCheck.value = (PlayerPrefs.GetInt("RememberMe", 0) == 1);

        if (string.IsNullOrEmpty(defaultName))
        {
            defaultName = "Guest" + UnityEngine.Random.Range(100, 99999);
        }

        tabManager.SelectTab(1);
        profileData.username = defaultName;
        profileData.clan     = defaultClan;

        if (rememberMeCheck.value)
        {
            usernameInput.value = PlayerPrefs.GetString("Username", "");
            passwordInput.value = DarkRef.DecryptString(PlayerPrefs.GetString("Pwd", ""));
            ignoreSound         = ignoreWait = true;
            StartLogin();
        }

        StartCoroutine(UpdateProfileInfo(-1));
    }
Exemplo n.º 22
0
    public void BloodSplat()
    {
        int randCount = DarkRef.RandomRange((int)splatCount.x, (int)splatCount.y);

        for (int i = 0; i < randCount; i++)
        {
            if (Physics.Raycast(tr.position, Random.onUnitSphere, out hit, Random.Range(splatDistance.x, splatDistance.y), splatLayers.value))
            {
                DecalObject splat = (DecalObject)Instantiate(splatDecal, hit.point, Quaternion.LookRotation(-hit.normal));
                splat.transform.parent = hit.transform;
                splat.transform.Rotate(Vector3.forward * Random.value * 360f, Space.Self);

                splat.targetObject   = hit.collider.gameObject;
                splat.pushOffset     = splatOffset;
                splat.layersToAffect = splatLayers;
            }
        }
    }
Exemplo n.º 23
0
    private void WeaponGUI()
    {
        shootImpulseGUI  = Mathf.Clamp(Mathf.Lerp(shootImpulseGUI, 1f, Time.unscaledDeltaTime * 5f), 1f, 1.11f);
        reloadImpulseGUI = Mathf.Clamp(Mathf.Lerp(reloadImpulseGUI, 1f, Time.unscaledDeltaTime * 5f), 1f, 1.11f);
        reloadSinAlpha   = (reloading) ? Mathf.Abs(Mathf.Sin(Time.time * 5f)) * 0.4f : 0f;

        curAmmoDisplay.color = (percent <= 0.33f && !wm.pe.hasEMP) ? new Color(1f, 0.3f, 0.1f, 1f - reloadSinAlpha) : new Color(1f, 1f, 1f, 1f - reloadSinAlpha);

        curAmmoDisplay.cachedTrans.localScale = Vector3.one * shootImpulseGUI;
        curAmmoDisplay.text = wm.displayCurAmmo.ToString();
        ammoLeftDisplay.cachedTrans.localScale = Vector3.one * reloadImpulseGUI;
        ammoLeftDisplay.text = wm.displayAmmoLeft.ToString();

        if (!wm.pe.hasEMP)
        {
            ammoBar.value = DarkRef.LerpTowards(ammoBar.value, percent, Time.deltaTime * 8f, Time.deltaTime * 2f, 0.5f);
        }
    }
Exemplo n.º 24
0
    private IEnumerator VersionCheckCoroutine()
    {
        multiplayerEnabled = true; //Set to false when version check is ready

        while (!multiplayerEnabled)
        {
            WWW verChk = new WWW("http://darkraze.byethost6.com/darkraze_files/versionChk.txt");

            yield return(verChk);

            bool unavailable = false;
            if (verChk.error != null)
            {
                mpErrorTooltip.text = "Version validation service is unavailable.";
                unavailable         = true;
            }
            else
            {
                if (DarkRef.RemoveSpaces(DarkRef.GetBuildVersion(true)) == DarkRef.RemoveSpaces(verChk.text))
                {
                    multiplayerEnabled = true;
                    yield break;
                }
                else
                {
                    Debug.LogWarning("Your version is not the latest! Multiplayer will be disabled");
                    mpErrorTooltip.text = "Your client version must be up-to-date to participate in multiplayer!";
                }
            }

            float waitTime = 0f;
            while (waitTime < 5.1f)
            {
                waitTime += Time.deltaTime;

                if (unavailable)
                {
                    mpErrorTooltip.text = "Version validation service is unavailable (retrying in: " + Mathf.Max(0f, 5.1f - waitTime).ToString("F0") + ").";
                }

                yield return(null);
            }
        }
    }
Exemplo n.º 25
0
    void NetworkShoot(float x, float y, Vector3 pos)
    {
        if (currentGC == null)
        {
            Debug.Log("Proxy gun is null");
            return;
        }

        if (Time.time - lastFireTime >= targetFireRate * 0.2f)
        {
            currentGC.firePos.GetComponent <AudioSource>().PlayOneShot(currentGC.fireSound);
            lastFireTime = Time.time;
        }

        GameObject poolProjectile = PoolManager.Instance.RequestInstantiate(currentGC.bulletInfo.poolIndex, pos, Quaternion.Euler(x * 360f, y * 360f, 0f), false);

        if (currentGC.bulletInfo.bulletType == BulletInfo.BulletType.Bullet)
        {
            Bullet bTracer = poolProjectile.GetComponent <Bullet>();
            bTracer.BulletInfo(currentGC.bulletInfo, -1, true);
            bTracer.InstantiateStart();
        }
        else if (currentGC.bulletInfo.bulletType == BulletInfo.BulletType.Rocket)
        {
            Rocket vRocket = poolProjectile.GetComponent <Rocket>();
            vRocket.RocketInfo(currentGC.bulletInfo, -1, true);
            vRocket.InstantiateStart();
        }

        if (renderV.isVisible && currentGC.ejectionEnabled && currentGC.ejectionPos != null)
        {
            Rigidbody bShell      = PoolManager.Instance.RequestInstantiate(currentGC.bulletShellIndex, currentGC.ejectionPos.position, currentGC.ejectionPos.rotation).GetComponent <Rigidbody>();
            Vector3   randomForce = DarkRef.RandomVector3(currentGC.ejectionMinForce, currentGC.ejectionMaxForce);
            bShell.velocity        = msP.velocity + transform.TransformDirection(randomForce);
            bShell.angularVelocity = Random.rotation.eulerAngles * currentGC.ejectionRotation;
        }

        if (currentVisuals.muzzleFlash != null && currentVisuals.muzzleGlow != null && currentVisuals.muzzleSpark != null)
        {
            StartCoroutine(MuzzleControl());
        }
    }
Exemplo n.º 26
0
    private IEnumerator WeaponNameTransition()
    {
        scramble = 0f;

        while (scramble < 0.99f)
        {
            scramble = DarkRef.LerpTowards(scramble, 1f, Time.deltaTime * 20f, Time.deltaTime, 0.2f);
            yield return(null);
        }

        scramble = 1f;

        while (scramble > 0.01f)
        {
            scramble = DarkRef.LerpTowards(scramble, 0f, Time.deltaTime * 20f, Time.deltaTime, 0.2f);
            yield return(null);
        }

        scramble = 0f;
    }
Exemplo n.º 27
0
    public override void InstantiateStart()
    {
        time = destroyTime + (Random.value * randomness);

        if (isParticle)
        {
            foreach (ParticleEmitter e in emitters)
            {
                e.Emit();
            }
        }

        if (fadeOut)
        {
            if (defAlpha == null)
            {
                defAlpha = new float[renderers.Length];
            }

            for (int i = 0; i < renderers.Length; i++)
            {
                if (renderers[i] == null)
                {
                    continue;
                }

                Color col = renderers[i].material.GetColor(colorName);

                if (defAlpha[i] <= 0f)
                {
                    defAlpha[i] = col.a;
                }

                renderers[i].material.SetColor(colorName, DarkRef.SetAlpha(col, defAlpha[i]));
            }
        }

        timer          = 0f;
        startedDestroy = false;
    }
Exemplo n.º 28
0
    void Update()
    {
        if (!Topan.Network.isConnected)
        {
            return;
        }

        if (chatLength != NetworkingGeneral.gameChatList.Count)
        {
            chatOutput.CopyList(NetworkingGeneral.gameChatList);
            chatLength = NetworkingGeneral.gameChatList.Count;
        }

        if (Time.unscaledTime - chatActionTime >= antiFloodTime && Input.GetKeyDown(KeyCode.Return))
        {
            if (!chatInput.isSelected)
            {
                chatInput.isSelected = true;
            }
            else
            {
                bool sameAsLastMsg = (chatOutput.chatList.Count > 0) ? DarkRef.RemoveSpaces(chatOutput.chatList[chatOutput.chatList.Count - 1].ToLower()) == DarkRef.RemoveSpaces(chatInput.value.ToLower()) : false;
                if (netView != null && !string.IsNullOrEmpty(DarkRef.RemoveSpaces(chatInput.value)) && !sameAsLastMsg)
                {
                    string message = "[DAA314]" + AccountManager.profileData.username + "[-]: " + chatInput.value;
                    netView.RPC(Topan.RPCMode.All, "ChatMessage", message);
                }

                if (!string.IsNullOrEmpty(chatInput.value))
                {
                    chatActionTime = Time.unscaledTime;
                }

                chatInput.value      = "";
                chatInput.isSelected = false;
            }
        }
    }
Exemplo n.º 29
0
    private IEnumerator StartDestroy()
    {
        startedDestroy = true;

        if (fadeOut)
        {
            float mod = 1f;
            while (mod > 0f)
            {
                mod -= Time.deltaTime * fadeSpeed;
                for (int i = 0; i < renderers.Length; i++)
                {
                    Color col = renderers[i].material.GetColor(colorName);
                    renderers[i].material.SetColor(colorName, DarkRef.SetAlpha(col, defAlpha[i] * Mathf.Clamp01(mod)));
                }
                yield return(null);
            }
        }

        if (transform.parent != null && transform.parent.name == "KeepScale")
        {
            Transform parent = transform.parent;
            transform.parent = null;
            Destroy(parent.gameObject);
        }

        if (poolObject)
        {
            AddToPool();
        }
        else
        {
            Destroy(gameObject);
        }

        timer = 0f;
    }
Exemplo n.º 30
0
    public void SwitchTeams(byte pID, byte team)
    {
        Topan.NetworkPlayer p = Topan.Network.GetPlayerByID((int)pID);
        if (p.HasPlayerData("team") && ((byte)p.GetPlayerData("team") == (byte)team))
        {
            return;
        }

        bool autoBalance = true;

        if (NetworkingGeneral.currentGameType.customSettings.ContainsKey("Team Auto-Balance"))
        {
            autoBalance = DarkRef.ConvertStringToBool(NetworkingGeneral.currentGameType.customSettings["Team Auto-Balance"].currentValue);
        }

        if (autoBalance && !NetworkingGeneral.currentGameType.ValidTeamSwitch((int)team))
        {
            return;
        }

        NetworkingGeneral.currentGameType.RemovePlayer((int)pID);
        NetworkingGeneral.currentGameType.AddPlayer((int)pID, (int)team);
        p.SetPlayerData("team", team);
    }