Ejemplo n.º 1
0
    public void CatchFish(FishDataObject fish)
    {
        _recentlyCaughtFish.Add(fish);
        if (_recentlyCaughtFish.Count > 3)
        {
            _recentlyCaughtFish.RemoveAt(0);
        }

        fish.data.saveData.numberCaught++;
        if (!fish.data.saveData.unlocked)
        {
            fish.data.saveData.unlocked               = true;
            fish.data.saveData.timeFirstCaughtHours   = System.DateTime.Now.Hour;
            fish.data.saveData.timeFirstCaughtMinutes = System.DateTime.Now.Minute;
            // show phone and stuff
            phoneManager.UpdateProfileCell(fish);
            phoneManager.SetTargetProfile(fish);
            youGotAMatchScreen.ShowSuccess(fish, goToPhone: true);
            OneShotManager.PlayOneShot(catchUnlockOneShot);
        }
        else
        {
            youGotAMatchScreen.ShowSuccess(fish);
            OneShotManager.PlayOneShot(catchSuccessOneShot);
        }
    }
Ejemplo n.º 2
0
    void LoadProfileData(FishDataObject fish)
    {
        profileScreenSprite.sprite = fish.data.profileSprite;
        nameTMP.text = fish.data.name;
        profileBlurbScrollRect.verticalNormalizedPosition = 1;
        blurbTMP.text = fish.data.profileText;

        _charArray.Clear();
        _charArray.Append((int)Mathf.Clamp(fish.data.saveData.numberCaught, 0, 999));
        caughtValueTMP.SetCharArray(_charArray.GetArray(), 0, _charArray.count);

        _charArray.Clear();
        _charArray.Append((int)Mathf.Clamp(fish.data.saveData.numberMissed, 0, 999));
        missedValueTMP.SetCharArray(_charArray.GetArray(), 0, _charArray.count);

        _charArray.Clear();
        if (fish.data.saveData.timeFirstCaughtHours < 10)
        {
            _charArray.Append(0);
        }
        _charArray.Append(fish.data.saveData.timeFirstCaughtHours);
        _charArray.Append(':');
        if (fish.data.saveData.timeFirstCaughtMinutes < 10)
        {
            _charArray.Append(0);
        }
        _charArray.Append(fish.data.saveData.timeFirstCaughtMinutes);
        timeTMP.SetCharArray(_charArray.GetArray(), 0, _charArray.count);
    }
Ejemplo n.º 3
0
 public void UpdateProfileCell(FishDataObject fishDataObject)
 {
     if (cellDict.TryGetValue(fishDataObject, out var profileCell))
     {
         profileCell.Initialize(profileCell.fishDataObject);
     }
 }
Ejemplo n.º 4
0
 public void ShowNewMatchScreen(FishDataObject fishProfile)
 {
     phoneScreen = PhoneScreen.NewMatch;
     newMatchScreenSprite.sprite = fishProfile.data.profileSprite;
     matchesScreen.SetActive(false);
     profileScreen.SetActive(false);
     newMatchScreen.SetActive(true);
 }
Ejemplo n.º 5
0
 public void ShowProfileScreen(FishDataObject fishProfile)
 {
     phoneScreen = PhoneScreen.Profile;
     LoadProfileData(fishProfile);
     matchesScreen.SetActive(false);
     newMatchScreen.SetActive(false);
     profileScreen.SetActive(true);
     OneShotManager.PlayOneShot(selectOneShot, 1f);
 }
Ejemplo n.º 6
0
 public void ScrollToFishProfile(FishDataObject fish, bool animate = true)
 {
     if (cellDict.TryGetValue(fish, out var profileCell))
     {
         _scrollStart      = scrollRect.verticalNormalizedPosition;
         _scrollTarget     = scrollRect.GetTargetScrollValue(profileCell.rectTransform);
         _scrollAnimationT = 0f;
         _animatingScroll  = true;
     }
 }
Ejemplo n.º 7
0
    public void ChangeFish(int fishIndex)
    {
        currentFishList.RemoveAt(fishIndex);
        List <FishDataObject> environmentList = environmentData.fishSpawnList.data;
        FishDataObject        newFish         = GetCandidateFish(currentFishList, environmentList);

        currentFishList.Insert(fishIndex, newFish);
        var portrait = fishPortraits[fishIndex];

        portrait.SetFishDataObject(newFish, animate: true);
    }
Ejemplo n.º 8
0
 public void SnapToCell(FishDataObject targetProfile)
 {
     if (cellDict.TryGetValue(targetProfile, out var profileCell))
     {
         _selectedCellIndex  = profileCell.index;
         selectedProfileCell = profileCell;
         selectedCellCursorTransform.position = selectedProfileCell.rectTransform.position;
         float scroll = scrollRect.GetTargetScrollValue(selectedCellCursorTransform);
         scrollRect.verticalNormalizedPosition = scroll;
     }
 }
    public void ShowSuccess(FishDataObject fish, bool goToPhone = false)
    {
        bobberAimBehaviour.enabled = false;
        animator.SetTrigger("ShowSuccess");
        profileSpriteRenderer.sprite = fish.data.profileSprite;
        messageCharArray.Clear();
        messageCharArray.Append(fish.data.saveData.numberCaught);
        messageCharArray.Append(GetNumericSuffix(fish.data.saveData.numberCaught));
        messageCharArray.Append(message);
        messageTextMeshPro.SetCharArray(messageCharArray.GetArray(), 0, messageCharArray.count);

        // nameCharArray.Clear();
        // nameCharArray.Append(fish.data.name);
        _goToPhone = goToPhone;
    }
Ejemplo n.º 10
0
    public override void OnInspectorGUI()
    {
        // Make sure object is up-to-date and we are displaying correct values:
        serializedObject.Update();

        // Draw default body content:
        base.OnInspectorGUI();

        // Draw 'refresh' button:
        if (GUILayout.Button("Refresh"))
        {
            // A list of all matching assets in the project that we will populate:
            List <FishDataObject> assetsInProject = new List <FishDataObject>();

            // Get guids for assets that match the given type:
            string[] guids = AssetDatabase.FindAssets("t:FishDataObject");

            for (int i = 0; i < guids.Length; i++)
            {
                // Using the asset guid, get a full path to the asset itself:
                string assetPath = AssetDatabase.GUIDToAssetPath(guids[i]);

                // Using the asset path, load the object itself:
                FishDataObject asset = AssetDatabase.LoadAssetAtPath <FishDataObject>(assetPath);

                // If nothing went wrong, then add the asset to our list:
                if (asset != null)
                {
                    assetsInProject.Add(asset);
                }
            }

            // Check if the target of this inspector is a SimpleDataCollection and cast it as that type:
            if (target is FishDataCollection simpleDataCollection)
            {
                // Finally, set the new list of objects on our collection:
                simpleDataCollection.SetDataObjectList(assetsInProject);
            }
        }

        // Apply any changes we made to the object:
        serializedObject.ApplyModifiedProperties();
    }
    public void SetFishDataObject(FishDataObject fishDataObject, bool animate = false)
    {
        if (animate)
        {
            nextFishObject = fishDataObject;
            animator.SetTrigger("ChangeFish");
            return;
        }
        var gameState = gameStateManager.gameState;

        if (fishDataObject.data.saveData.unlocked)
        {
            portraitSpriteRenderer.sprite  = fishDataObject.data.profileSprite;
            lockStateSpriteRenderer.sprite = unlockSprite;
        }
        else
        {
            portraitSpriteRenderer.sprite  = mysterySprite;
            lockStateSpriteRenderer.sprite = lockSprite;
        }
    }
Ejemplo n.º 12
0
 public void MissFish(FishDataObject fish)
 {
     fish.data.saveData.numberMissed++;
 }
Ejemplo n.º 13
0
 public void Initialize(FishDataObject fishDataObject)
 {
     this.fishDataObject = fishDataObject;
     image.sprite        = fishDataObject.data.saveData.unlocked ? fishDataObject.data.profileSprite : lockedSprite;
 }
Ejemplo n.º 14
0
 public void ShowMatches(FishDataObject profile)
 {
     _targetProfile = profile;
     ShowMatches();
 }
Ejemplo n.º 15
0
 public void SetTargetProfile(FishDataObject profile)
 {
     _targetProfile = profile;
 }