Exemple #1
0
 private void waitForGameStart()
 {
     if (!m_networkManager.currentActiveRoom.GetVariable("state").GetStringValue().Equals("wait_for_min_players") && (isGameStartReceived || m_networkManager.currentActiveRoom.GetVariable("state").GetStringValue().Equals("play")))
     {
         m_networkManager.sendClientState("ready");
         if (m_networkManager.currentActiveRoom.GetVariable("state").GetStringValue().Equals("play"))
         {
             chat.AddSystemMessage("Starting Game In Progress . . .");
         }
         else
         {
             chat.AddSystemMessage("Starting Game . . .");
         }
         GameObject    gameObject    = GameObject.Find("Tracker");
         TrackerScript trackerScript = gameObject.GetComponent("TrackerScript") as TrackerScript;
         trackerScript.AddMetric(TrackerScript.Metric.MATCH_READY);
         if (m_networkManager.currentActiveRoom.GetVariable("state").GetStringValue().Equals("play"))
         {
             trackerScript.AddMetric(TrackerScript.Metric.DROP_INTO_MATCH);
         }
         Object.DestroyObject(AtlasMusic);
         Object.DestroyObject(BanzaiMusic);
         StartCoroutine(LoadGameAndWait());
         queueState = pause;
     }
 }
    private void Awake()
    {
        if (Application.isEditor)
        {
            GameData.MATCH_MODE = GameData.Build.DEBUG;
        }
        if (GameData.MyPlayStatus > 1)
        {
            getMissionInProgressUpdate();
        }
        GL.ClearWithSkybox(true, Camera.main);
        GameObject    gameObject    = GameObject.Find("Tracker");
        TrackerScript trackerScript = gameObject.GetComponent("TrackerScript") as TrackerScript;

        trackerScript.AddMetric(TrackerScript.Metric.IN_HANGAR);
        trackerScript.updateMetricStats();
        GameObject gameObject2 = GameObject.Find("NetworkManager");

        m_networkManager          = (gameObject2.GetComponent("NetworkManager") as NetworkManager);
        m_state                   = Home;
        Camera.main.renderingPath = RenderingPath.UsePlayerSettings;
        if (GameData.eventObjects.ContainsKey("platform"))
        {
            GameObject gameObject3 = Object.Instantiate(GameData.eventObjects["platform"] as GameObject) as GameObject;
            GUIUtil.mInstance.mBackground = gameObject3.transform;
        }
    }
Exemple #3
0
 void ToggleZ()
 {
     ConstrainZ         = !ConstrainZ;
     ToolTracker.net[2] = 2;
     ToolTracker.net[3] = 3;
     if (ConstrainZ)
     {
         ToolTracker.value[0] = "2";
     }
     else
     {
         ToolTracker.value[0] = "1";
     }
     ToolTracker.setEmpty(1);
     TrackerScript.AddAction();
     foreach (var s in Zlisteners)
     {
         if (ConstrainZ)
         {
             s.Enable();
         }
         else
         {
             s.Disable();
         }
     }
 }
    public int drawButtons(Rect box, GUISkin skin)
    {
        string        b             = (Event.current.type != EventType.Repaint) ? lastHover : string.Empty;
        GameObject    gameObject    = GameObject.Find("Tracker");
        TrackerScript trackerScript = gameObject.GetComponent("TrackerScript") as TrackerScript;

        switch (GUIUtil.Button(new Rect(7.5f, box.height / 2f - 29f, 123f, 58f), "PLAY\nBATTLE", mFactionButton))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                b = "PLAY\nBATTLE";
                if (lastHover != b)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            b = "PLAY\nBATTLE";
            GameData.ConsecutiveGames = 0;
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            type = 1;
            trackerScript.AddMetric(TrackerScript.Metric.REQUEST_BATTLE);
            break;
        }
        GUIUtil.GUIEnable(GameData.MyPlayStatus > 1 || GameData.MATCH_MODE == GameData.Build.DEBUG);
        switch (GUIUtil.Button(new Rect(box.width / 2f + 2.5f - 10f, box.height / 2f - 29f, 143f, 58f), "PLAY\nTEAM BATTLE", mFactionButton))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                b = "PLAY\nTEAM BATTLE";
                if (lastHover != b)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            b = "PLAY\nTEAM BATTLE";
            GameData.ConsecutiveGames = 0;
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            type = 2;
            trackerScript.AddMetric(TrackerScript.Metric.REQUEST_TEAM_BATTLE);
            break;
        }
        GUIUtil.GUIEnable(bEnable: true);
        lastHover = b;
        return(type);
    }
Exemple #5
0
 void ScaleDown()
 {
     if (eraser.transform.parent.parent.localScale.x > 0.2f)
     {
         eraser.transform.parent.parent.localScale -= scaleVector;
         ToolTracker.net[3]   = 3;
         ToolTracker.value[0] = "f";
         ToolTracker.value[2] = "" + scaleVector.magnitude;
         ToolTracker.setEmpty(2);
         TrackerScript.AddAction();
     }
 }
Exemple #6
0
    public void ScaleShapeDown()
    {
        float newRadius = radius - 0.005f;

        if (newRadius >= 0.02f)
        {
            radius               = newRadius;
            ToolTracker.net[2]   = 1;
            ToolTracker.net[3]   = 3;
            ToolTracker.value[0] = "f";
            ToolTracker.value[1] = "" + newRadius;
            ToolTracker.setEmpty(2);
            TrackerScript.AddAction();
        }
    }
Exemple #7
0
    public void ScaleShapeUp()
    {
        float newRadius = radius + 0.005f;

        if (newRadius <= 0.20f)
        {
            radius               = newRadius;
            ToolTracker.net[2]   = 1;
            ToolTracker.net[3]   = 2;
            ToolTracker.value[0] = "f";
            ToolTracker.value[1] = "" + newRadius;
            ToolTracker.setEmpty(2);
            TrackerScript.AddAction();
        }
    }
Exemple #8
0
    void SetupTracker()
    {
        tracker = GameObject.Find("Tracker").GetComponent <TrackerScript>();

        // Determine if tablet or phone
        string screenType = "?";

        if (Application.platform == RuntimePlatform.Android)
        {
            float widthInchesSqrd  = Mathf.Pow(DisplayMetricsAndroid.WidthPixels / DisplayMetricsAndroid.XDPI, 2);
            float heightInchesSqrd = Mathf.Pow(DisplayMetricsAndroid.HeightPixels / DisplayMetricsAndroid.YDPI, 2);
            diagonalInInches = Mathf.Sqrt(widthInchesSqrd + heightInchesSqrd);
            //Debug.Log(string.Format("diagonalInInches = {0}", diagonalInInches));
            if (diagonalInInches < SCREEN_TABLET_INCH)
            {
                screenType = "P";
            }
            else
            {
                screenType = "T";
            }
        }
        else
        {
            // Lets just use pixels
            diagonalInPixels = Mathf.Sqrt(Mathf.Pow(Screen.width, 2) + Mathf.Pow(Screen.height, 2));
            //Debug.Log(string.Format("diagonalInPixels = {0}", diagonalInPixels));
            if (diagonalInPixels < SCREEN_TABLET_PX)
            {
                screenType = "P";
            }
            else
            {
                screenType = "T";
            }
        }

        // Level name based on mode number
        level = string.Format("{0}{1}-{2}", modeNum, screenType, NotesData.DIFFICULTY_LEVEL.Substring(0, 1));

        // Song started
        tracker.Counter(level, "started");

        // Force send
        tracker.Resume();
        tracker.Pause();
    }
Exemple #9
0
    private void Awake()
    {
        GameData.WorldID = -1;
        Debug.Log("Tutorial: " + bSinglePlayer + " " + GameData.MyTutorialStep);
        if (GameData.MyTutorialStep == 1)
        {
            GameData.WorldID        = 0;
            GameData.WorldVersion   = "tutorial";
            GameData.GameType       = 2;
            GameData.MyTutorialStep = 2;
            bSinglePlayer           = true;
            Object.Instantiate(FirstUsePrefab);
            GameData.MyPlayerId = 1;
            SFSObject sFSObject = new SFSObject();
            sFSObject.PutInt("playStatus", GameData.MyPlayStatus);
            sFSObject.PutInt("playerId", GameData.MyPlayerId);
            sFSObject.PutUtfString("playerName", GameData.MyDisplayName);
            sFSObject.PutInt("suitIdx", GameData.MySuitID);
            sFSObject.PutInt("playerFaction", GameData.MyFactionId);
            sFSObject.PutInt("textureIdx", GameData.MyTextureID);
            sFSObject.PutInt("weaponIdx", GameData.MyWeaponID);
            sFSObject.PutInt("powers", GameData.MyPowers);
            sFSObject.PutInt("level", GameData.MyLevel);
            sFSObject.PutBool("leveledUp", val: false);
            GameData.addPlayer(1, sFSObject);
        }
        else
        {
            isGameStartReceived   = false;
            GameData.WorldVersion = "normal";
            GameData.GameType     = 1;
        }
        SharedSkin = GUIUtil.mInstance.mSharedSkin;
        QueueSkin  = GUIUtil.mInstance.mQueueSkin;
        GameObject gameObject = GameObject.Find("NetworkManager");

        m_networkManager = (gameObject.GetComponent("NetworkManager") as NetworkManager);
        GameObject    gameObject2   = GameObject.Find("Tracker");
        TrackerScript trackerScript = gameObject2.GetComponent("TrackerScript") as TrackerScript;

        trackerScript.AddMetric(TrackerScript.Metric.IN_LOBBY);
    }
Exemple #10
0
    void SendTrackerData()
    {
        string        level   = common.level;
        TrackerScript tracker = common.tracker;

        // Song finished
        tracker.Counter(level, "feedbackSubmitted");

        // Accuracy
        tracker.Average(level, "ratingChallenge", ratings[0]);
        tracker.Average(level, "ratingIntuitive", ratings[1]);
        tracker.Average(level, "ratingUnique", ratings[2]);
        tracker.Average(level, "ratingFun", ratings[3]);
        tracker.Average(level, "ratingOverall", ratings[4]);

        // Force send
        tracker.Resume();

        // Exit
        common.OnBackButton();
    }
Exemple #11
0
    public void ToggleLengthConstraint()
    {
        ConstrainLength = !ConstrainLength;
        photonView.RPC("UpdateLengthConstraint", PhotonTargets.AllBufferedViaServer, ConstrainLength, LengthConstraint);

        ToolTracker.net[2] = 5;
        ToolTracker.net[3] = 1;
        if (ConstrainLength)
        {
            ToolTracker.value[0] = "2";
            ToolTracker.value[1] = "f";
            ToolTracker.value[2] = "" + LengthConstraint;
            ToolTracker.setEmpty(2);
        }
        else
        {
            ToolTracker.value[0] = "1";
            ToolTracker.setEmpty(1);
        }

        TrackerScript.AddAction();
    }
Exemple #12
0
    private void Start()
    {
        GameMusic        = (UnityEngine.Object.Instantiate(GameMusic) as GameObject);
        state            = waitForLoadConfig;
        mSharedSkin      = GUIUtil.mInstance.mSharedSkin;
        mVersion         = (Resources.Load("version/number") as TextAsset);
        GameData.version = mVersion.text;
        if (mVersion == null)
        {
            Debug.Log("************* unable to read version *********");
        }
        mTracker      = new GameObject();
        mTracker.name = "Tracker";
        UnityEngine.Object.DontDestroyOnLoad(mTracker);
        TrackerScript trackerScript = mTracker.AddComponent <TrackerScript>();

        trackerScript.AddMetric(TrackerScript.Metric.WANT_TO_PLAY);
        GameObject gameObject = GameObject.Find("NetworkManager");

        mNetworkManager = (gameObject.GetComponent <NetworkManager>() as NetworkManager);
        UnityEngine.Object.DontDestroyOnLoad(gameObject);
    }
Exemple #13
0
    void calculateAnalytics()
    {
        //gonna need a better algorithm for more tools

        if (Valve.VR.OpenVR.IsHmdPresent())
        {
            Valve.VR.HmdQuad_t roomDims = new Valve.VR.HmdQuad_t();
            SteamVR_PlayArea.GetBounds(SteamVR_PlayArea.Size.Calibrated, ref roomDims);
            Vector3 roomScale = new Vector3(Mathf.Abs(roomDims.vCorners0.v0 - roomDims.vCorners2.v0), Mathf.Abs(roomDims.vCorners0.v2 - roomDims.vCorners2.v2), 1);
            roomWidth  = roomScale.x;
            roomHeight = roomScale.y;
        }

        int   mostToolNum   = 0;
        float mostToolTimed = 0;

        foreach (KeyValuePair <string, ToolData> pair in toolMap)
        {
            if (pair.Value.Count > mostToolNum)
            {
                mostToolGrab = pair.Value.Name;
                mostToolNum  = pair.Value.Count;
            }

            if (pair.Value.Time > mostToolTimed)
            {
                mostToolTime  = pair.Value.Name;
                mostToolTimed = pair.Value.Time;
            }
        }

        string mostCommonPairLetters = MostCommonSubstring();

        if (mostCommonPairLetters.Length == 2)
        {
            string firstTool  = toolMap[mostCommonPairLetters[0].ToString()].Name;
            string secondTool = toolMap[mostCommonPairLetters[1].ToString()].Name;
            mostCommonToolPairs = firstTool + " to " + secondTool;
        }

        timeCamera       = toolMap["A"].Time;
        numCamera        = toolMap["A"].Count;
        timeBoolean      = toolMap["B"].Time;
        numBoolean       = toolMap["B"].Count;
        timeClone        = toolMap["C"].Time;
        numClone         = toolMap["C"].Count;
        timeDrawFace     = toolMap["D"].Time;
        numDrawFace      = toolMap["D"].Count;
        timeExtrude      = toolMap["E"].Time;
        numExtrude       = toolMap["E"].Count;
        timeLoft         = toolMap["F"].Time;
        numLoft          = toolMap["F"].Count;
        timeGroup        = toolMap["G"].Time;
        numGroup         = toolMap["G"].Count;
        timePrimitive    = toolMap["I"].Time;
        numPrimitive     = toolMap["I"].Count;
        timeClipping     = toolMap["K"].Time;
        numClipping      = toolMap["K"].Count;
        timeLine         = toolMap["L"].Time;
        numLine          = toolMap["L"].Count;
        timeMirror       = toolMap["M"].Time;
        numMirror        = toolMap["M"].Count;
        timeSelection    = toolMap["N"].Time;
        numSelection     = toolMap["N"].Count;
        timePolygon      = toolMap["O"].Time;
        numPolygon       = toolMap["O"].Count;
        timePaint        = toolMap["P"].Time;
        numPaint         = toolMap["P"].Count;
        timeEraser       = toolMap["R"].Time;
        numEraser        = toolMap["R"].Count;
        timeSpline       = toolMap["S"].Time;
        numSpline        = toolMap["S"].Count;
        timeGravity      = toolMap["V"].Time;
        numGravity       = toolMap["V"].Count;
        timeExtrudeCurve = toolMap["X"].Time;
        numExtrudeCurve  = toolMap["X"].Count;
        timeMeasuring    = toolMap["Z"].Time;
        numMeasuring     = toolMap["Z"].Count;

        //here i get the most used shapes and sections
        // this can be done more efficiently
        List <int> shapeList   = new List <int>();
        List <int> sectionList = new List <int>();

        shapeList.Add(numTriangle);
        shapeList.Add(numSquare);
        shapeList.Add(numCircle);
        sectionList.Add(numIsec);
        sectionList.Add(numCsec);
        sectionList.Add(numLsec);
        sectionList.Add(numTsec);

        int shapeNum = shapeList[0];
        int shapeInd = 0;
        int secNum   = sectionList[0];
        int secInd   = 0;

        for (int k = 0; k < shapeList.Count; k++)
        {
            if (shapeList[k] > shapeNum)
            {
                shapeNum = shapeList[k];
                shapeInd = k;
            }
        }

        for (int l = 0; l < sectionList.Count; l++)
        {
            if (sectionList[l] > shapeNum)
            {
                secNum = sectionList[l];
                secInd = l;
            }
        }

        if (shapeNum > 0)
        {
            switch (shapeInd)
            {
            case 0:
                commonShape = "Triangle";
                break;

            case 1:
                commonShape = "Square";
                break;

            case 2:
                commonShape = "Circle";
                break;
            }
        }
        else
        {
            commonShape = "NONE";
        }

        if (secNum > 0)
        {
            switch (secInd)
            {
            case 0:
                commonSection = "I Section";
                break;

            case 1:
                commonSection = "C Section";
                break;

            case 2:
                commonSection = "L Section";
                break;

            case 3:
                commonSection = "T Section";
                break;
            }
        }
        else
        {
            commonSection = "NONE";
        }

        if (shapeNum > secNum)
        {
            shapeVsSection = "Shape";
        }
        else if (secNum > shapeNum)
        {
            shapeVsSection = "Section";
        }
        else if (secNum == shapeNum)
        {
            shapeVsSection = "Equal";
        }

        float saveSum = 0;

        numSaves = saveSizes.Count;
        if (numSaves > 0)
        {
            for (int i = 0; i < numSaves; i++)
            {
                saveSum += saveSizes[i];
            }
            avgSaveSize = saveSum / numSaves;
        }
        else
        {
            avgSaveSize = 0;
        }


        //for now, just get color average, not common colors - pretty innacurate
        float sumR = 0;
        float sumG = 0;
        float sumB = 0;

        for (int ci = 0; ci < colors.Count; ci++)
        {
            float r = colors[ci].r;
            float g = colors[ci].g;
            float b = colors[ci].b;

            sumR += r;
            sumG += g;
            sumB += b;
        }

        float avgR = sumR / colors.Count;
        float avgG = sumG / colors.Count;
        float avgB = sumB / colors.Count;

        avgR *= 255.0f;
        avgG *= 255.0f;
        avgB *= 255.0f;

        avgColor = "(" + avgR + "," + avgG + "," + avgB + ")";

        if (heights.Count > 0)
        {
            userHeight = heights[heights.Count * 3 / 4];
        }
        else
        {
            userHeight = 0;
        }

        userHeight *= 1.5f;

        maxPeople = maxActive + maxPassiveVR + maxPassiveController + maxTheatre;

        TrackerScript.AddAction("*");
    }
Exemple #14
0
    private void DrawStory(bool bIsGuest)
    {
        string b = (Event.current.type != EventType.Repaint) ? lastHover : string.Empty;

        GUI.DrawTexture(StoryBGRect, StoryBG);
        GUI.color = new Color(1f, 1f, 1f, Mathf.Max(1f - StoryTimer * 2f, 0f));
        GUI.Box(StoryBGRect, GUIContent.none, mSharedSkin.GetStyle("blackbox"));
        GUI.color = new Color(1f, 1f, 1f, StoryTimer - 1.5f);
        Rect  storyTextBGRect = StoryTextBGRect;
        float width           = storyTextBGRect.width;
        Color color           = GUI.color;

        storyTextBGRect.width = width * (1f + Mathf.Max(0.25f * (1f - color.a), 0f));
        storyTextBGRect.x     = (900f - storyTextBGRect.width) / 2f;
        GUI.DrawTexture(storyTextBGRect, StoryTextBG);
        GUI.color       = new Color(1f, 1f, 1f, StoryTimer - 2.5f);
        storyTextBGRect = StoryTitleRect;
        float width2 = storyTextBGRect.width;
        Color color2 = GUI.color;

        storyTextBGRect.width = width2 * (1f + Mathf.Max(0.25f * (1f - color2.a), 0f));
        storyTextBGRect.x     = (900f - storyTextBGRect.width) / 2f;
        GUI.DrawTexture(storyTextBGRect, StoryTitle);
        GUI.color       = new Color(1f, 1f, 1f, StoryTimer - 3.5f);
        storyTextBGRect = StoryTextRect;
        float width3 = storyTextBGRect.width;
        Color color3 = GUI.color;

        storyTextBGRect.width = width3 * (1f + Mathf.Max(0.25f * (1f - color3.a), 0f));
        storyTextBGRect.x     = (900f - storyTextBGRect.width) / 2f;
        GUI.DrawTexture(storyTextBGRect, StoryText);
        GUI.color       = new Color(1f, 1f, 1f, StoryTimer - 4.5f);
        storyTextBGRect = StoryExoSymbolRect;
        float width4 = storyTextBGRect.width;
        Color color4 = GUI.color;

        storyTextBGRect.width = width4 * (1f + Mathf.Max(0.25f * (1f - color4.a), 0f));
        storyTextBGRect.x     = (900f - storyTextBGRect.width) / 2f;
        GUI.DrawTexture(storyTextBGRect, StoryExoSymbol);
        if (StoryTimer > 6.5f)
        {
            GUI.color = new Color(1f, 1f, 1f, Mathf.Min(1f, StoryTimer - 6.5f));
            if (bIsGuest)
            {
                switch (GUIUtil.Button(new Rect(290f, 475f, 135f, 60f), "PLAY AS GUEST", mSharedSkin.GetStyle("DarkButton")))
                {
                case GUIUtil.GUIState.Hover:
                case GUIUtil.GUIState.Active:
                    if (Event.current.type == EventType.Repaint)
                    {
                        b = "GUEST";
                        if (lastHover != b)
                        {
                            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                        }
                    }
                    break;

                case GUIUtil.GUIState.Click:
                {
                    b = "GUEST";
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
                    if (GameData.MATCH_MODE == GameData.Build.DEBUG && Input.GetKey(KeyCode.F1))
                    {
                        GameData.MyFactionId = 1;
                    }
                    else if (GameData.MATCH_MODE == GameData.Build.DEBUG && Input.GetKey(KeyCode.F2))
                    {
                        GameData.MyFactionId = 2;
                    }
                    else
                    {
                        GameData.MyFactionId = UnityEngine.Random.Range(1, 3);
                    }
                    state    = loadGuest;
                    bLoading = true;
                    GameObject    gameObject    = GameObject.Find("Tracker");
                    TrackerScript trackerScript = gameObject.GetComponent("TrackerScript") as TrackerScript;
                    trackerScript.AddMetric(TrackerScript.Metric.GUEST_OR_LOGIN);
                    break;
                }
                }
                switch (GUIUtil.Button(new Rect(475f, 475f, 135f, 60f), "LOGIN", mSharedSkin.GetStyle("DarkButton")))
                {
                case GUIUtil.GUIState.Hover:
                case GUIUtil.GUIState.Active:
                    if (Event.current.type == EventType.Repaint)
                    {
                        b = "LOGIN";
                        if (lastHover != b)
                        {
                            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                        }
                    }
                    break;

                case GUIUtil.GUIState.Click:
                {
                    b = "LOGIN";
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
                    Application.ExternalCall("LoginModule.showLoginWindow({visible: true}, 'login')");
                    mStatus = "Waiting for Cartoon Network Login or Registration . . .";
                    state   = waitForLogin;
                    authenticatePlayer();
                    state       = waitForPlayerAuthentication;
                    mPlayStatus = 0;
                    GameObject    gameObject2    = GameObject.Find("Tracker");
                    TrackerScript trackerScript2 = gameObject2.GetComponent("TrackerScript") as TrackerScript;
                    trackerScript2.AddMetric(TrackerScript.Metric.GUEST_OR_LOGIN);
                    break;
                }
                }
                if (GameData.MATCH_MODE == GameData.Build.DEBUG)
                {
                    switch (GUIUtil.Button(new Rect(290f, 535f, 135f, 60f), "DEV NEW PLAYER", mSharedSkin.GetStyle("DarkButton")))
                    {
                    case GUIUtil.GUIState.Hover:
                    case GUIUtil.GUIState.Active:
                        if (Event.current.type == EventType.Repaint)
                        {
                            b = "DEV NEW PLAYER";
                            if (lastHover != b)
                            {
                                GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                            }
                        }
                        break;

                    case GUIUtil.GUIState.Click:
                        b = "DEV NEW PLAYER";
                        GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
                        GameData.MyPlayStatus = 2;
                        break;
                    }
                }
                switch (GUIUtil.Button(new Rect(475f, 475f, 135f, 60f), "LOGIN", mSharedSkin.GetStyle("DarkButton")))
                {
                case GUIUtil.GUIState.Hover:
                case GUIUtil.GUIState.Active:
                    if (Event.current.type == EventType.Repaint)
                    {
                        b = "LOGIN";
                        if (lastHover != b)
                        {
                            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                        }
                    }
                    break;

                case GUIUtil.GUIState.Click:
                {
                    b = "LOGIN";
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
                    Application.ExternalCall("LoginModule.showLoginWindow({visible: true}, 'login')");
                    mStatus     = "Waiting for Cartoon Network Login or Registration . . .";
                    state       = waitForLogin;
                    mPlayStatus = 0;
                    GameObject    gameObject3    = GameObject.Find("Tracker");
                    TrackerScript trackerScript3 = gameObject3.GetComponent("TrackerScript") as TrackerScript;
                    trackerScript3.AddMetric(TrackerScript.Metric.GUEST_OR_LOGIN);
                    break;
                }
                }
            }
            else
            {
                switch (GUIUtil.Button(new Rect(383f, 475f, 135f, 60f), "BOOT CAMP", mSharedSkin.GetStyle("DarkButton")))
                {
                case GUIUtil.GUIState.Hover:
                case GUIUtil.GUIState.Active:
                    if (Event.current.type == EventType.Repaint)
                    {
                        b = "BOOT CAMP";
                        if (lastHover != b)
                        {
                            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                        }
                    }
                    break;

                case GUIUtil.GUIState.Click:
                    b = "BOOT CAMP";
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
                    bLoading = true;
                    if (isTestLoggedLocal)
                    {
                        loadTestNewPlayer();
                    }
                    else
                    {
                        loadNewPlayer();
                    }
                    mStatus = "Loading New Player... " + GameData.MyDisplayName;
                    setPause(120, playAsNewPlayer);
                    break;
                }
            }
        }
        lastHover = b;
    }
Exemple #15
0
 public void PickUp(TrackerScript tracker)
 {
     AttachedTo = tracker.transform;
     RigidBody.useGravity = false;
     RigidBody.velocity = new Vector3();
 }
    private void OnGUI()
    {
        curhover           = ((Event.current.type != EventType.Repaint) ? lastHover : string.Empty);
        GUIUtil.GUIEnabled = true;
        GUI.BeginGroup(new Rect(screenSpace.x, screenSpace.y, 100000f, 200000f));
        GUI.skin  = mSharedSkin;
        GUI.depth = 5;
        string str = (GameData.MyPlayStatus <= 1) ? "Guest " : string.Empty;

        str = str + " " + GameData.getFactionDisplayName(GameData.MyFactionId);
        GUIUtil.mInstance.mModelRenderer.transform.rotation = Quaternion.identity;
        switch (NavState)
        {
        case 0:
            SetSuitTransform(tabhome.ModelTransform);
            tabhome.showTab(screenSpace);
            break;

        case 1:
            SetSuitTransform(tabshowcase.mSuitInspector.ModelTransforms[0]);
            tabshowcase.showTab(screenSpace);
            break;
        }
        GUI.color = Color.white;
        GUI.DrawTexture(new Rect(0f, 0f, screenSpace.width, 5f), Border);
        GUI.DrawTexture(new Rect(0f, screenSpace.height - 24f, screenSpace.width, 24f), Border);
        GUI.DrawTexture(new Rect(0f, 0f, 5f, screenSpace.height), Border);
        GUI.DrawTexture(new Rect(screenSpace.width - 5f, 0f, 5f, screenSpace.height), Border);
        GUIUtil.GUIEnableOverride(bEnable: true);
        GUI.Box(new Rect(FlagPos - 43.5f, 5f, 257f, 20f), GameData.getFactionDisplayName(GameData.MyFactionId).ToUpper(), "FactionFlagTop");
        GUIUtil.GUIEnable(bEnable: true);
        GUI.BeginGroup(new Rect(screenSpace.width - (float)XPCreditsImg.width, screenSpace.height - (float)XPCreditsImg.height, XPCreditsImg.width, XPCreditsImg.height));
        GUI.DrawTexture(new Rect(0f, 0f, XPCreditsImg.width, XPCreditsImg.height), XPCreditsImg);
        GUI.Label(new Rect(0f, 0f, XPCreditsImg.width, XPCreditsImg.height), GameData.MyTotalCredits.ToString(), "Credits");
        if (GameData.MyLevel == 50)
        {
            GUI.Box(new Rect(10f, 72f, 243f, 26f), GUIContent.none, "MaxLevel");
        }
        else
        {
            GUI.Box(new Rect(12f, 74f, 50f + Mathf.Max(0f, 150f * (((float)GameData.MyTotalXP - (float)GameData.getExpNeededForLevel(GameData.MyLevel)) / (float)(GameData.getExpNeededForLevel(GameData.MyLevel + 1) - GameData.getExpNeededForLevel(GameData.MyLevel)))), 22f), GUIContent.none, "XPBar");
            GUI.Label(new Rect(0f, 0f, XPCreditsImg.width, XPCreditsImg.height), GameData.MyLevel.ToString(), "MyLevel");
            GUI.Label(new Rect(0f, 0f, XPCreditsImg.width, XPCreditsImg.height), (GameData.MyLevel + 1).ToString(), "NextLevel");
        }
        GUI.EndGroup();
        GUI.BeginGroup(new Rect(0f, screenSpace.height - (float)PlayerImgBG.height, PlayerImgBG.width, PlayerImgBG.height));
        GUI.DrawTexture(new Rect(0f, 0f, PlayerImgBG.width, PlayerImgBG.height), PlayerImgBG);
        if (avatarTexture != null)
        {
            GUI.DrawTexture(new Rect(4f, PlayerImgBG.height - 47, 43f, 43f), avatarTexture);
        }
        else
        {
            avatarTexture = (Resources.Load("HUD/avatar/" + GameHUD.avatar_images[GameData.MySuitID - 1]) as Texture2D);
        }
        GUI.EndGroup();
        GUI.BeginGroup(new Rect(0f, 0f, NavButtonsBG.width + 100, NavButtonsBG.height));
        GUI.DrawTexture(new Rect(NavIndicator, 37.5f, 87f, 79f), NavStateImg[(GameData.MyFactionId - 1) * 2 + NavState]);
        GUI.DrawTexture(new Rect(0f, 0f, NavButtonsBG.width, NavButtonsBG.height), NavButtonsBG);
        switch (GUIUtil.CustomButton(NavButtonTris, new Rect(6f, 5f, 81f, 72f), GUIContent.none, "Home" + GameData.MyFactionId))
        {
        case GUIUtil.GUIState.Click:
            curhover = "Home";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            DoTransition(0);
            break;

        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "Home";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;
        }
        switch (GUIUtil.CustomButton(NavButtonTris, new Rect(6f, 80f, 81f, 72f), GUIContent.none, "Hangar" + GameData.MyFactionId))
        {
        case GUIUtil.GUIState.Click:
            curhover = "Hangar";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            DoTransition(1);
            FirstUse.DoAction(FirstUse.Frame.RequiredAction.Open_Showcase);
            break;

        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "Hangar";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;
        }
        GUI.EndGroup();
        GUI.BeginGroup(new Rect(screenSpace.width - (float)PlayButtonBG.width, 0f, PlayButtonBG.width, PlayButtonBG.height));
        GUI.DrawTexture(new Rect(0f, 0f, PlayButtonBG.width, PlayButtonBG.height), PlayButtonBG);
        int num = (int)(Time.realtimeSinceStartup * 24f) % animmod;

        switch (GUIUtil.CustomButton(PlayButtonTris, new Rect(8f, 4f, 195f, 51f), GUIContent.none, "Battle" + GameData.MyFactionId))
        {
        case GUIUtil.GUIState.Inactive:
        case (GUIUtil.GUIState) 3:
        case (GUIUtil.GUIState) 5:
            GUI.DrawTexture(new Rect(8f, 4f, 195f, 51f), BattleText);
            break;

        case GUIUtil.GUIState.None:
            if (num < 20)
            {
                GUI.color = ((GameData.MyFactionId != 1) ? new Color(0.8f, 0.8f, 0.8f) : Color.yellow);
                GUI.DrawTexture(new Rect(6f, 4f, 174f, 50f), BattleButtonAnimFrames[num]);
                GUI.color = Color.white;
            }
            GUI.DrawTexture(new Rect(8f, 4f, 195f, 51f), BattleText);
            break;

        case GUIUtil.GUIState.Active:
            if (num < 20)
            {
                GUI.color = ((GameData.MyFactionId != 1) ? new Color(0.48f, 0.49f, 0.22f) : new Color(0.73f, 0.19f, 0.09f));
                GUI.DrawTexture(new Rect(6f, 4f, 174f, 50f), BattleButtonAnimFrames[num]);
                GUI.color = Color.white;
            }
            GUI.DrawTexture(new Rect(8f, 4f, 195f, 51f), BattleText);
            break;

        case GUIUtil.GUIState.Hover:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "Battle";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
                if (num < 20)
                {
                    GUI.color = ((GameData.MyFactionId != 1) ? new Color(0.48f, 0.49f, 0.22f) : new Color(0.73f, 0.19f, 0.09f));
                    GUI.DrawTexture(new Rect(6f, 4f, 174f, 50f), BattleButtonAnimFrames[num]);
                    GUI.color = Color.white;
                }
                GUI.color = Color.black;
                GUI.DrawTexture(new Rect(8f, 4f, 195f, 51f), BattleText);
                GUI.color = Color.white;
            }
            break;

        case GUIUtil.GUIState.Click:
            curhover = "Battle";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            battleType = 1;
            m_networkManager.m_gameModeStr = GameMode.freeforall.ToString();
            break;
        }
        GUIUtil.GUIEnable(GameData.MyPlayStatus != 1 || GameData.MATCH_MODE == GameData.Build.DEBUG);
        switch (GUIUtil.CustomButton(PlayButtonTris, new Rect(176f, 4f, 195f, 51f), GUIContent.none, "TeamBattle" + GameData.MyFactionId))
        {
        case GUIUtil.GUIState.Inactive:
        case (GUIUtil.GUIState) 3:
        case (GUIUtil.GUIState) 5:
            GUI.DrawTexture(new Rect(176f, 4f, 195f, 51f), TeamBattleText);
            break;

        case GUIUtil.GUIState.None:
            GUI.color = ((GameData.MyFactionId != 1) ? new Color(0.8f, 0.8f, 0.8f) : Color.yellow);
            if (num < 20)
            {
                GUI.DrawTexture(new Rect(175f, 4f, 174f, 50f), BattleButtonAnimFrames[num]);
            }
            if (num >= 7 && num < 25)
            {
                GUI.DrawTexture(new Rect(158f, 4f, 174f, 50f), BattleButtonAnimFrames[num - 5]);
            }
            if (num >= 14 && num < 30)
            {
                GUI.DrawTexture(new Rect(141f, 4f, 174f, 50f), BattleButtonAnimFrames[num - 10]);
            }
            GUI.color = Color.white;
            GUI.DrawTexture(new Rect(176f, 4f, 195f, 51f), TeamBattleText);
            break;

        case GUIUtil.GUIState.Active:
            GUI.color = ((GameData.MyFactionId != 1) ? new Color(0.48f, 0.49f, 0.22f) : new Color(0.73f, 0.19f, 0.09f));
            if (num < 20)
            {
                GUI.DrawTexture(new Rect(175f, 4f, 174f, 50f), BattleButtonAnimFrames[num]);
            }
            if (num >= 7 && num < 25)
            {
                GUI.DrawTexture(new Rect(158f, 4f, 174f, 50f), BattleButtonAnimFrames[num - 5]);
            }
            if (num >= 14 && num < 30)
            {
                GUI.DrawTexture(new Rect(141f, 4f, 174f, 50f), BattleButtonAnimFrames[num - 10]);
            }
            GUI.color = Color.white;
            GUI.DrawTexture(new Rect(176f, 4f, 195f, 51f), TeamBattleText);
            break;

        case GUIUtil.GUIState.Hover:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "TeamBattle";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
                GUI.color = ((GameData.MyFactionId != 1) ? new Color(0.48f, 0.49f, 0.22f) : new Color(0.73f, 0.19f, 0.09f));
                if (num < 20)
                {
                    GUI.DrawTexture(new Rect(175f, 4f, 174f, 50f), BattleButtonAnimFrames[num]);
                }
                if (num >= 7 && num < 25)
                {
                    GUI.DrawTexture(new Rect(158f, 4f, 174f, 50f), BattleButtonAnimFrames[num - 5]);
                }
                if (num >= 14 && num < 30)
                {
                    GUI.DrawTexture(new Rect(141f, 4f, 174f, 50f), BattleButtonAnimFrames[num - 10]);
                }
                GUI.color = Color.black;
                GUI.DrawTexture(new Rect(176f, 4f, 195f, 51f), TeamBattleText);
                GUI.color = Color.white;
            }
            break;

        case GUIUtil.GUIState.Click:
            curhover = "TeamBattle";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            battleType = 2;
            m_networkManager.m_gameModeStr = GameMode.team.ToString();
            break;
        }
        GUIUtil.GUIEnable(bEnable: true);
        GUI.EndGroup();
        GUI.Box(new Rect(50f, screenSpace.height - 20f, screenSpace.width - 55f, 16f), GameData.MyDisplayName.ToUpper(), "NameBanner" + GameData.MyFactionId);
        GUI.Box(new Rect(screenSpace.width - 124f, screenSpace.height - 20f, 4f, 16f), GUIContent.none, "Separator");
        GUI.Box(new Rect(screenSpace.width - 243f, screenSpace.height - 20f, 4f, 16f), GUIContent.none, "Separator");
        switch (GUIUtil.Toggle(new Rect(screenSpace.width - 120f, screenSpace.height - 20f, 115f, 16f), GameData.MyFactionId == 2, GUIContent.none, "FullScreen"))
        {
        case GUIUtil.GUIState.Click:
        case (GUIUtil.GUIState) 24:
        case (GUIUtil.GUIState) 40:
            curhover = "FullScreen";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            if (Screen.fullScreen)
            {
                Screen.SetResolution(900, 600, fullscreen: false);
            }
            else
            {
                Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, fullscreen: true);
            }
            break;

        case GUIUtil.GUIState.Hover:
        case (GUIUtil.GUIState) 18:
        case (GUIUtil.GUIState) 20:
        case (GUIUtil.GUIState) 34:
        case (GUIUtil.GUIState) 36:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "FullScreen";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;
        }
        switch (GUIUtil.Toggle(new Rect(screenSpace.width - 239f, screenSpace.height - 20f, 115f, 16f), GameData.MyFactionId == 2, GUIContent.none, "Options"))
        {
        case GUIUtil.GUIState.Click:
        case (GUIUtil.GUIState) 24:
        case (GUIUtil.GUIState) 40:
            curhover = "Options";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            DynamicOptions.bDrawing = true;
            FirstUse.DoAction(FirstUse.Frame.RequiredAction.Open_Options);
            break;

        case GUIUtil.GUIState.Hover:
        case (GUIUtil.GUIState) 18:
        case (GUIUtil.GUIState) 20:
        case (GUIUtil.GUIState) 34:
        case (GUIUtil.GUIState) 36:
            if (Event.current.type == EventType.Repaint)
            {
                curhover = "Options";
                if (lastHover != curhover)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;
        }
        if (bAllowSocial)
        {
            GUI.Box(new Rect(screenSpace.width - 362f, screenSpace.height - 20f, 4f, 16f), GUIContent.none, "Separator");
            switch (GUIUtil.Toggle(new Rect(screenSpace.width - 358f, screenSpace.height - 20f, 115f, 16f), GameData.MyFactionId == 2, GUIContent.none, "Friends"))
            {
            case GUIUtil.GUIState.Click:
            case (GUIUtil.GUIState) 24:
            case (GUIUtil.GUIState) 40:
                curhover = "Friends";
                GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
                bDrawFriends = !bDrawFriends;
                FirstUse.DoAction(FirstUse.Frame.RequiredAction.Open_Options);
                break;

            case GUIUtil.GUIState.Hover:
            case (GUIUtil.GUIState) 18:
            case (GUIUtil.GUIState) 20:
            case (GUIUtil.GUIState) 34:
            case (GUIUtil.GUIState) 36:
                if (Event.current.type == EventType.Repaint)
                {
                    curhover = "Friends";
                    if (lastHover != curhover)
                    {
                        GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                    }
                }
                break;
            }
        }
        if (battleType > 0 && !m_connected)
        {
            GameObject    gameObject    = GameObject.Find("Tracker");
            TrackerScript trackerScript = gameObject.GetComponent("TrackerScript") as TrackerScript;
            GameData.ConsecutiveGames = 0;
            trackerScript.AddMetric((battleType != 1) ? TrackerScript.Metric.REQUEST_TEAM_BATTLE : TrackerScript.Metric.REQUEST_BATTLE);
            trackerScript.updateMetricStats();
            GameData.BattleType      = battleType;
            GameData.IsChooserActive = false;
            Debug.Log("requesting battletype " + battleType);
            Connect();
        }
        GUI.EndGroup();
        if (m_DrawHolidayEvent != null)
        {
            m_DrawHolidayEvent();
        }
        if (m_isLogin)
        {
            GUI.Label(new Rect(10f, 90f, 90f, 100f), "TegId: ");
            GameData.MyTEGid = GUI.TextField(new Rect(100f, 90f, 150f, 20f), GameData.MyTEGid);
            GUI.Label(new Rect(270f, 90f, 90f, 100f), "AuthId: ");
            GameData.MyAuthid     = GUI.TextField(new Rect(370f, 90f, 200f, 20f), GameData.MyAuthid);
            GameData.MyPlayStatus = 3;
        }
        GUI.DrawTexture(BlackBox1, GUI.skin.GetStyle("blackbox").normal.background);
        GUI.DrawTexture(BlackBox2, GUI.skin.GetStyle("blackbox").normal.background);
        if (bAllowSocial && bDrawFriends && !DynamicOptions.bDrawing)
        {
            FriendsWindow.x = screenSpace.width - 358f;
            FriendsWindow.y = screenSpace.height - FriendsWindow.height - 27f;
            GUI.Window(1700, FriendsWindow, DrawFriendsList, GUIContent.none);
        }
        lastHover = curhover;
    }
Exemple #17
0
    public void EndDrawing()
    {
        // set the collider and the mesh
        if (go != null)
        {
            if (objectType == ObjectType.Shape)
            {
                go.GetComponent <ShapeSplineTrail>().CancelTracking();

                // end reflection
                if (ms.gameObject.activeSelf)
                {
                    ms.reflection.GetComponent <ShapeSplineTrail>().CancelTracking();
                }
                GameObject.Find("Tracker").GetComponent <TrackerScript>().numMesh++;
                ObjectManager.instance.AddObject(go);
                go.GetComponent <MeshEditor>().StartGroupGeneration();
            }
            else if (objectType == ObjectType.Section)
            {
                go.GetComponent <SectionSplineTrail>().CancelTracking();

                // end reflection
                if (ms.gameObject.activeSelf)
                {
                    ms.reflection.GetComponent <SectionSplineTrail>().CancelTracking();
                }
                GameObject.Find("Tracker").GetComponent <TrackerScript>().numMesh++;
                ObjectManager.instance.AddObject(go);
                go.GetComponent <MeshEditor>().StartGroupGeneration();
            }
            else if (objectType == ObjectType.Hair)
            {
                go.GetComponent <HairSplineTrail>().CancelTracking();

                // end reflection
                if (ms.gameObject.activeSelf)
                {
                    ms.reflection.GetComponent <HairSplineTrail>().CancelTracking();
                }
                GameObject.Find("Tracker").GetComponent <TrackerScript>().numMesh++;

                var        refTrail = go.GetComponent <HairSplineTrail>();
                GameObject trail    = Instantiate(Resources.Load("NURBSTrail"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                trail.GetComponent <NURBSTrail>().InitNURBS(refTrail.spline, refTrail.trackLength, new Vector3(0.005f, 0, 0));
                trail.GetComponent <MeshRenderer>().material.color = go.GetComponent <MeshRenderer>().material.color;
                Destroy(go);
                refTrail.Init(hairObject);
                ObjectManager.instance.AddObject(trail);
            }

            shapeObject.GetComponent <ProcShape>().Init();
            sectionObject.GetComponent <ProcSection>().Init();
            hairObject.GetComponent <ProcHair>().Init();

            ToolTracker.setEmpty(4);
            TrackerScript.AddAction();
        }

        // add reflection
        if (ms.gameObject.activeSelf)
        {
            ObjectManager.instance.AddObject(ms.reflection);
        }

        go = null;
    }