-
Notifications
You must be signed in to change notification settings - Fork 4
Updated AvatarEditor #1165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Updated AvatarEditor #1165
Conversation
- Hardcoded to hair atm
attached script to HorizontalScrollView-Grid instead of BottomMenu
- Added VerticalScrollViewGrid for category selection - renamed ScrollBarContentLoader script to ScrollBarFeatureLoader
- Also removed placeholder images from verticalscroll
VerticalScrollView-Grid => CategoryGrid HorizontalScrollView-Grid => FeatureGrid
- Clicking features on FeatureGrid now updates the character - Made SetFeature function from FeaturePicker public to bypass old logic - Feature slot that's being changed hardcoded to hair for now - Made BookImage transparent in editor to see more easily
- Now changing the category works - Feature category Id:s being hardcoded is not optimal, returning to it later
- Added LayoutElement component to prefab - Replaced many CategoryGrid components - Added UpdateCellSize function Category selection now shows 3 categories regardless of screen size/aspect ratio. It does not update when changing screen size while the app is running for now.
Not sure if OnEndDrag is the right event yet
- It now clicks the button on the cell after clamping - Clicking the cells still works too, planning on changing this later
- Now there are cells now both top and bottom when loading the grid items
- Renamed wrongly named variable - Made CategoryGrid create 3 of each category for future purposes
Body part was in hair category
|
|
||
| float t = 0f; | ||
|
|
||
| while (t < 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vähän epäselvä toteutus, vaikka onkin tarpeellinen. Ymmärrän että tämän on tarkoitus tapahtua 0,2 sekunnissa ja sen takia toi kertominen 5:llä, mut kannattaa varmaankin kirjoittaa kommentti tähän siitä.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kirjoitin selkeämmäksi
|
|
||
| private void OnClamp(float targetYPos) | ||
| { | ||
| float totalCellSize = _categoryLoader.cellHeight + _categoryLoader.spacing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tämä sama laskuhan tehdään tossa ClampToCenterissä, voisiko tuon indeksin antaa sieltä.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tehty. Lisäsin myös sen että dragin aloittaminen lopettaa jo käynnissä olevan clamppauksen
| GameObject colorGridCell = Instantiate(_gridCellPrefab, _colorGridContent); | ||
| GridCellHandler handler = colorGridCell.GetComponent<GridCellHandler>(); | ||
|
|
||
| Vector2 colorImageMinAnchors = new(0.05f, 0.05f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nimeämis säännöt. Toinen on kirjoitettu isolla, toinen pienellä.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Korjattu
| } | ||
| } | ||
|
|
||
| private void AddListener() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kannattaa kirjoittaa kommentti, jos koodi on keskeneräinen. (Erottaa onko jotain mitä on tulossa myöhemmin vai että onko vahingossa lisätty/jäänyt.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tehty. Pidetään mielessä jatkossa.
| public string GetSelectedFeature(int index) => | ||
| index >= 0 && index < _selectedFeatures.Count ? _selectedFeatures[index] : null; | ||
|
|
||
| public void SetSelectedFeature(int index, string value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muuttaisin nämä metodit niin, että ne on yksityisiä ja sit vain lisäisin uudet julkiset, joille annetaan suoraan toi AvatarPiece enum, joka kertoo mikä pala pitäisi olla käytössä.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Laitoin yksityiseksi. En tehnyt uusia julkisia kun niitä ei tällä hetkellä käytetä missään muualla
| _selectedFeatures[index] = value; | ||
| } | ||
|
|
||
| public List<AvatarPartInfo> GetCurrentCategoryFeatures() => _currentCategoryFeatures; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tarvitseeko näitä metodeita (ja samoin että onko toi _currentCategoryFeatures tarpeellinen)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ei tarvitse, poistin paljon muutakin käyttämätöntä mitä oli jäänyt vanhasta koodista
| [SerializeField] private AvatarPartsReference _avatarPartsReference; | ||
| private List<string> _selectedFeatures = new List<string>(new string[7]); | ||
| private List<AvatarPartInfo> _currentCategoryFeatures = new(); | ||
| private CharacterClassType _characterClassType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tarvitseeko hahmon luokan tietoja olla tässä metodissa? Nehän saa muualta jos tarvitsee.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ei tarvitse, oli jäänyt vahingossa
| [SerializeField] private Image _featureImage; | ||
| [SerializeField] private Button _button; | ||
|
|
||
| public void SetValues(Sprite cellImage = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suosittlen uudelleen järjestämään nämä muuttujat sillä, esim. toi cellImagen värin oleminen viimeisenä kun taas toi cellImage on ensimmäinen haittaa hieman luettavuutta.
Lisäksi kannattaa kysyä pitäisikö, joku tieto pistää pakolliseksi ettei päädy käyttämään metodia ilman muuttujia.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Järjestin uudelleen. Mitään tiettyä tietoa en laittanut pakolliseksi koska ei ole yhtä tiettyä mitä käytän aina, mutta antaa nyt varoituksen eikä tee mitään jos metodi kutsutaan ilman muuttujia.
| { | ||
| if (_selectedCellHandler != null) | ||
| { | ||
| _selectedCellHandler.SetValues(backgroundColor: _backgroundColor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voisiko nämä arvot antaa Handlerille tuossa kun se luodaan ja sitten vain käskeä sitä vaihtaa niitä edestakaisin tarpeen mukaan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tehty
-Removed double index calculation -Made while loop more clear to read -Coroutine now stops if you click again before it has finished
Made anchors not exceed value 1 or be less than 0
-Clicking the category cells now selects them in addition to dragging -Bugs out if you go in same direction a few times, need to rethink infinitescroll
-Buttons now disabled until the animation finishes -Now loops correctly when only clicking buttons
-Now no longer goes beyond the given screen space
-Now shows a warning and does nothing if called without no arguments
-Set functions not needed elsewhere private
-Made own scrips for featurecell, categorycell and colorcell that inherift from gridcellhandler -Made each its own prefab -Adjusted scripts to work with these changes
Replaced the current page/book style categorization with a sideways scrolling bar
Replaced category selection with a vertical scroll that shows 3 items at a time
Added color selection visually
Added a speech bubble that shows a random phrase listed in the GDD when opening AvatarEditor
Added a confirmation popup window for saving
Left old scripts in the files if needed for reference in the near future
Known Issues