示例#1
0
    public void DrawPreview(EventPanel eventPanel)
    {
        if (currentEventPanel)
        {
            currentEventPanel.SetActive(false);
        }

        currentEventPanel = eventPanel;
        eventPanelController.gameObject.SetActive(true);
        List <Action> actionList = eventPanel.generalEvent.GetChildrenComponents <Action>();

        if (actionList.Count > 0)
        {
            eventPanelController.descriptionText.text = Localization.Instance.GetLocale(eventPanel.generalEvent.description_id);
            eventPanelController.EventActionPanel.DrawActions(actionList, true);
        }
        else
        {
            List <Outcome> outcomList = eventPanel.generalEvent.GetChildrenComponents <Outcome>();
            if (outcomList.Count > 1)
            {
                (eventPanelController.EventActionPanel as EditorActionPanelController).DrawPreview(outcomList);
            }
            else
            {
                DrawPreview(outcomList[0]);
            }
        }

        eventPanel.SetActive(true);
    }
示例#2
0
    public void RandomEvent()
    {
        int    type        = Random.Range(1, 8);
        string Description = "";

        if (type == 1)
        {
            Description = "全体恢复10点心力";
            for (int i = 0; i < TargetDep.CurrentEmps.Count; i++)
            {
                TargetDep.CurrentEmps[i].Mentality += 10;
            }
        }
        else if (type == 2)
        {
            Description = "全体员工降低20点心力";
            for (int i = 0; i < TargetDep.CurrentEmps.Count; i++)
            {
                TargetDep.CurrentEmps[i].Mentality -= 20;
            }
        }
        else if (type == 3)
        {
            Description = "随机一个非基础技能不可用";
            List <SkillInfo> S = new List <SkillInfo>();
            for (int i = 0; i < CurrentSkills.Count; i++)
            {
                if (CurrentSkills[i].Active == true && CurrentSkills[i].skill.Type != SkillType.Basic)
                {
                    S.Add(CurrentSkills[i]);
                }
            }
            if (S.Count > 0)
            {
                int num = Random.Range(0, S.Count);
                S[num].Active = false;
                S[num].gameObject.SetActive(false);
            }
        }
        else if (type == 4)
        {
            Description = "一名员工退场(技能不可用)";
            Employee E = TargetDep.CurrentEmps[Random.Range(0, TargetDep.CurrentEmps.Count)];
            for (int i = 0; i < CurrentSkills.Count; i++)
            {
                if (CurrentSkills[i].skill.TargetEmp == E)
                {
                    CurrentSkills[i].gameObject.SetActive(false);
                }
            }
        }
        else if (type == 5)
        {
            Description = "下一次使用非基础技能的消耗翻倍";
            if (Sp4Multiply == 0)
            {
                for (int i = 0; i < CurrentSkills.Count; i++)
                {
                    if (CurrentSkills[i].skill.Type != SkillType.Basic)
                    {
                        CurrentSkills[i].skill.StaminaExtra = CurrentSkills[i].skill.StaminaCost;
                    }
                }
            }
            else
            {
                for (int i = 0; i < CurrentSkills.Count; i++)
                {
                    if (CurrentSkills[i].skill.Type != SkillType.Basic)
                    {
                        CurrentSkills[i].skill.StaminaExtra *= 2;
                    }
                }
            }
            Sp4Multiply += 1;
        }
        else if (type == 6)
        {
            Description = "所有基础技能消耗翻倍";
            for (int i = 0; i < CurrentSkills.Count; i++)
            {
                if (CurrentSkills[i].skill.Type == SkillType.Basic)
                {
                    if (CurrentSkills[i].skill.StaminaExtra == 0)
                    {
                        CurrentSkills[i].skill.StaminaExtra = CurrentSkills[i].skill.StaminaCost * -1;
                    }
                    else
                    {
                        CurrentSkills[i].skill.StaminaExtra *= 2;
                    }
                }
            }
        }
        else if (type == 7)
        {
            Description  = "所有技能必须额外使用一枚点数为1的骰子才可以使用";
            Sp5Multiply += 1;
        }
        Text_EventDescription.text = Description;
        EventPanel.SetActive(true);
    }