// clue knob button void ShowClue(string clueLine, ShogunCharacter characterPortrait) { SetStateInfoBubble(true); clueDescription.text = clueLine; popupCharacterPortrait.SetCharacterPortrait(characterPortrait); }
ShogunCharacter GetCharacter(Character character) { ShogunCharacter selected = characters.Find(item => { return(item.character == character); }); if (selected == null) { Debug.LogError(debugableInterface.debugLabel + "Couldn't find ShogunCharacter with character " + character.ToString()); return(null); } if (!selected.initialized) { Debug.LogError(debugableInterface.debugLabel + "ShogunCharacter is not initialized (this will cause null refs later)"); return(null); } return(selected); }
public void Init(bool isUnlocked, Clue clue, ShogunCharacter characterPortrait, Action <string, ShogunCharacter> showClue) { this.isUnlocked = isUnlocked; this.clue = clue; this.showClue = () => { showClue.Invoke(clue.summary, characterPortrait); }; locked.SetActive(true); unlocked.SetActive(false); selected.SetActive(false); lockedKanji.Skin(); unlockedBack.Skin(); selectedBack.Skin(); selected.SetActive(false); isSelected = false; initializableInterface.InitInternal(); }
public void SetCharacterPortrait(ShogunCharacter shogunCharacter, Button button = null) { clothes.sprite = shogunCharacter.characterClothes; skin.sprite = shogunCharacter.characterSkin; detail.sprite = shogunCharacter.characterDetail; eyes.sprite = shogunCharacter.characterEyes; over.sprite = shogunCharacter.characterOver; if (button != null) { selfButton = button; ColorBlock block = button.colors; block.normalColor = Skinning.GetSkin(normalTag); block.highlightedColor = GameData.GetColorFromCharacter(shogunCharacter.character); block.disabledColor = Skinning.GetSkin(normalTag); button.colors = block; } Show(); Grey(false); }
void SpawnKnobs(List <Clue> clueList, List <ShogunCharacter> characters) { // compute real spawn zone (apply padding) Rect rectangle = clueKnobSpawnZone.rect; rectangle.xMin += clueKnobSpawnPadding / 2; rectangle.yMin += clueKnobSpawnPadding / 2; rectangle.xMax -= clueKnobSpawnPadding / 2; rectangle.yMax -= clueKnobSpawnPadding / 2; // debug // Image temp = Instantiate(popupCharacterPortrait, clueKnobSpawnZone); // temp.transform.localPosition = clueKnobSpawnZone.localPosition; // temp.enabled = true; // temp.color = Color.red; // RectTransform tempRectTransform = temp.GetComponent<RectTransform>(); // tempRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, clueKnobSpawnZone.rect.width); // tempRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, clueKnobSpawnZone.rect.height); // tempRectTransform.localPosition = new Vector2(clueKnobSpawnZone.rect.xMin + clueKnobSpawnZone.rect.width / 2, clueKnobSpawnZone.rect.yMin + clueKnobSpawnZone.rect.height / 2); // temp = Instantiate(popupCharacterPortrait, clueKnobSpawnZone); // temp.transform.localPosition = rectangle.position; // temp.enabled = true; // temp.color = Color.green; // tempRectTransform = temp.GetComponent<RectTransform>(); // tempRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectangle.width); // tempRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectangle.height); // tempRectTransform.localPosition = new Vector2(rectangle.xMin + rectangle.width / 2, rectangle.yMin + rectangle.height / 2); // debug // list of spawned clue knobs to check distance with existing knobs spawnedKnobs = new List <ClueKnob>(); foreach (Clue clue in clueList) { positionComputingStep = 0; Vector3 targetPosition = ComputeRandomPosition(rectangle); ClueKnob spawned = Instantiate(clueKnobPrefab, clueKnobSpawnZone); spawned.transform.localPosition = targetPosition; spawnedKnobs.Add(spawned); ShogunCharacter character = characters.Find(item => { return(item.character == clue.giverCharacter); }); if (character == null) { Debug.LogError(debugableInterface.debugLabel + "Couldn't find ShogunCharacter for character " + clue.giverCharacter + "(this will generate errors later)"); continue; } spawned.Init(false, clue, character, (string clueDetail, ShogunCharacter portrait) => { // shows clue only if unlocked if (!spawned.isLocked) { ShowClue(clueDetail, character); } }); } }