示例#1
0
    /// <summary>
    /// 检查条件满足
    /// </summary>
    /// <param name="page">事件页序号</param>
    /// <returns></returns>
    public bool isConditionMet(int page)
    {
        EventPage pageInfo       = this.getPageInfo(page);
        bool      switchFlag     = true;
        bool      variableFlag   = true;
        bool      selfSwitchFlag = true;

        // 检查开关
        if (pageInfo.activeSwitches.Length > 0)
        {
            switchFlag = new List <GameInterpreter.ActiveSwitch>(pageInfo.activeSwitches).TrueForAll(
                _switch => GameTemp.gameSwitches[_switch.index]
                );
        }
        // 检查变量
        if (pageInfo.activeVariables.Length > 0)
        {
            variableFlag = new List <GameInterpreter.ActiveVariable>(pageInfo.activeVariables).TrueForAll(
                _variable => GameTemp.gameVariables[_variable.index] >= _variable.value
                );
        }
        // 检查独立开关
        if (pageInfo.activeSelfSwitches.Length > 0)
        {
            selfSwitchFlag = new List <GameInterpreter.ActiveSelfSwitch>(pageInfo.activeSelfSwitches).TrueForAll(
                _selfSwitch => GameTemp.gameSelfSwitches[GameSelfSwitches.key(this.mapName, this.eventId, _selfSwitch.index)]
                );
        }
        return(switchFlag && variableFlag && selfSwitchFlag);
    }
    public bool forceSet(string mapName, int eventId, string code, bool value)
    {
        string key = GameSelfSwitches.key(mapName, eventId, GameSelfSwitches.code(code));

        this[key] = value;
        return(value);
    }
示例#3
0
    /// <summary>
    /// 123 独立开关操作
    /// A
    /// true
    /// </summary>
    /// <returns></returns>
    public bool command_setSelfSwitch()
    {
        Debug.Log(string.Format("command_setSelfSwitch"));
        string code  = this.currentParam[0].Trim().ToUpper();
        bool   value = bool.Parse(this.currentParam[1]);

        string key = GameSelfSwitches.key(this.mapName, this.eventId, GameSelfSwitches.code(code));

        GameTemp.gameSelfSwitches[key] = value;
        GameTemp.gameMap.needRefresh   = true;
        return(true);
    }