コード例 #1
0
    private void onCmdSwitch(Story.CmdCase[] caseArray)
    {
        int numCaseArray    = caseArray.Length;
        int numCaseBtnArray = _caseBtnArray.Length;

        if (numCaseArray > numCaseBtnArray)
        {
            Log.Error("invalid case count; bigger then max case count");
            return;
        }

        for (int i = 0; i < numCaseArray; ++i)
        {
            Story.CmdCase c = caseArray[i];
            _caseBtnArray[i].Set(c.Key, c.Description);
            _caseBtnArray[i].gameObject.SetActive(true);
        }

        for (int i = numCaseArray; i < numCaseBtnArray; ++i)
        {
            _caseBtnArray[i].Set(-1, string.Empty);
            _caseBtnArray[i].gameObject.SetActive(false);
        }

        Show();
    }
コード例 #2
0
        public CmdSwitch(Sugarism.CmdSwitch model, Mode mode) : base(model, mode)
        {
            _model = model;

            _caseList = new List <CmdCase>();
            foreach (Sugarism.CmdCase mCase in _model.CaseList)
            {
                CmdCase cmdCase = new CmdCase(mCase, Mode);
                _caseList.Add(cmdCase);
            }
        }
コード例 #3
0
        public override bool Play()
        {
            Log.Debug(ToString());

            if (false == _isCalled)
            {
                Mode.CmdSwitchEvent.Invoke(_caseList.ToArray());

                _isCalled = true;
                return(true);    // can play more.
            }

            int selectedKey = Mode.CaseKey;

            if (false == isValid(selectedKey))
            {
                Log.Error(string.Format("invalid key: {0}", selectedKey));
                return(false);
            }

            CmdCase cmdCase = _caseList[selectedKey];

            return(cmdCase.Play());
        }