コード例 #1
0
        private void SetStats()
        {
            detectiveName.text = detective.characterName;
            portrait.sprite    = detective.characterAvatar;
            sex.text           = string.Format("Sex: {0}", detective.sex.ToString());
            age.text           = string.Format("Age: {0}", detective.age.ToString());
            salary.text        = string.Format("Salary: {0} / week", detective.salary.ToString());
            health.text        = string.Format("Health: {0} {1}/{2}/{3}", detective.GetHealthDescription(), detective.minHealth, (int)detective.curHealth, detective.maxHealth);
            loyalty.text       = string.Format("Loyalty: {0}/{1}/{2}", detective.minLoyalty, (int)detective.curLoyalty, detective.maxLoyalty);
            confidence.text    = string.Format("Confidence: {0}/{1}/{2}", detective.minConfidence, (int)detective.curConfidence, detective.maxConfidence);
            // experience.text = string.Format("Experience: {0}/{1}/{2}", detective., (int)detective.curLoyalty, detective.maxLoyalty);
            stress.text     = string.Format("Stress: {0} {1}/{2}/{3}", detective.GetStressDescription(), detective.minStress, (int)detective.curStress, detective.maxStress);
            brutal.text     = string.Format("- {0}: {1} {2}/{3}", Method.Brutal.ToString(), detective.GetMethodDescription(Method.Brutal), detective.GetMethodValue(Method.Brutal), detective.GetMaxMethodValue(Method.Brutal));
            careful.text    = string.Format("- {0}: {1} {2}/{3}", Method.Accuracy.ToString(), detective.GetMethodDescription(Method.Accuracy), detective.GetMethodValue(Method.Accuracy), detective.GetMaxMethodValue(Method.Accuracy));
            diplomatic.text = string.Format("- {0}: {1} {2}/{3}", Method.Diplomacy.ToString(), detective.GetMethodDescription(Method.Diplomacy), detective.GetMethodValue(Method.Diplomacy), detective.GetMaxMethodValue(Method.Diplomacy));
            science.text    = string.Format("- {0}: {1} {2}/{3}", Method.Science.ToString(), detective.GetMethodDescription(Method.Science), detective.GetMethodValue(Method.Science), detective.GetMaxMethodValue(Method.Science));
            List <TraitContainer> traits = new List <TraitContainer>();

            for (int i = 0; i < traitPanel.childCount; i++)
            {
                TraitLine line = traitPanel.GetChild(i).GetComponent <TraitLine>();
                if (line != null)
                {
                    if (!detective.traits.Contains(line.trait))
                    {
                        Destroy(line.gameObject);
                    }
                    else
                    {
                        traits.Add(line.trait);
                    }
                }
            }
            foreach (TraitContainer trait in detective.traits)
            {
                if (trait.trait.category == TraitCategory.FENOTYPE)
                {
                    fenotype.text = string.Format("Fenotype: {0}", trait.trait.traitName);
                }
                else if (!traits.Contains(trait))
                {
                    TraitLine line = Instantiate(traitLine, traitPanel);
                    line.SetTrait(trait);
                }
            }
        }
コード例 #2
0
        // Use this for initialization
        public void Show(iRolloverOwner rolloverOwner)
        {
            gameObject.SetActive(true);
            owner = rolloverOwner;
            Detective     detective     = null;
            RectTransform rectTransform = gameObject.GetComponent <RectTransform>();

            transform.parent = owner.GetRectTransform();
            rectTransform.SetPositionAndRotation(new Vector2(owner.GetRectTransform().position.x, rectTransform.position.y), Quaternion.identity);
            if (owner is DetectiveIcon)
            {
                detective = ((DetectiveIcon)owner).detective;
                rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, owner.GetRectTransform().rect.yMax + 10, rectTransform.rect.height);
            }
            else if (owner is DetectiveReportIcon)
            {
                detective = ((DetectiveReportIcon)owner).detective;
                rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, owner.GetRectTransform().rect.yMin + 10 + rectTransform.rect.height, rectTransform.rect.height);
            }
            else if (owner is DetectiveEventPanelIcon)
            {
                detective = ((DetectiveEventPanelIcon)owner).detective;
                rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, owner.GetRectTransform().rect.yMin + 10 + rectTransform.rect.height, rectTransform.rect.height);
            }
            transform.parent = InterfaceManager.GetInstantiate().canvas.transform;
            if (rectTransform.offsetMin.x < -Screen.width / 2)
            {
                rectTransform.SetPositionAndRotation(new Vector2(rectTransform.position.x - (rectTransform.offsetMin.x + Screen.width / 2) + 10, rectTransform.position.y), Quaternion.identity);
            }
            else if (rectTransform.offsetMax.x > Screen.width / 2)
            {
                rectTransform.SetPositionAndRotation(new Vector2(rectTransform.position.x + (Screen.width / 2 - rectTransform.offsetMin.x) - 10, rectTransform.position.y), Quaternion.identity);
            }
            if (detective != null)
            {
                detectiveName.text = detective.characterName;
                temper.text        = detective.temper.ToString().ToLower();
                health.text        = detective.GetHealthDescription();
                stress.text        = detective.GetStressDescription();
                brutal.text        = detective.GetMethodDescription(Method.Brutal);
                accuracy.text      = detective.GetMethodDescription(Method.Accuracy);
                diplomacy.text     = detective.GetMethodDescription(Method.Diplomacy);
                science.text       = detective.GetMethodDescription(Method.Science);
            }
        }