示例#1
0
    /// <summary>
    /// 获取触发条件详情
    /// </summary>
    /// <param name="rewardType"></param>
    /// <returns></returns>
    public static EventTriggerBean GetTriggerDetails(EventTriggerBean triggerData, GameDataBean gameData)
    {
        switch (triggerData.triggerType)
        {
        case EventTriggerEnum.Year:
            GetTriggerDetailsForDate(triggerData, gameData.gameTime.year);
            break;

        case EventTriggerEnum.Month:
            GetTriggerDetailsForDate(triggerData, gameData.gameTime.month);
            break;

        case EventTriggerEnum.Day:
            GetTriggerDetailsForDate(triggerData, gameData.gameTime.day);
            break;

        case EventTriggerEnum.Favorability:
            GetTriggerDetailsForFavorability(triggerData, gameData);
            break;

        case EventTriggerEnum.EventIds:
            GetTriggerDetailsForEventIds(triggerData, gameData);
            break;

        case EventTriggerEnum.Marry:
            GetTriggerDetailsForMarry(triggerData, gameData);
            break;
        }
        return(triggerData);
    }
示例#2
0
 /// <summary>
 /// 获取触发条件详情 已经触发过的事件ID
 /// </summary>
 /// <param name="triggerData"></param>
 /// <param name="gameData"></param>
 private static void GetTriggerDetailsForEventIds(EventTriggerBean triggerData, GameDataBean gameData)
 {
     long[] idsData = StringUtil.SplitBySubstringForArrayLong(triggerData.triggerData, ',');
     if (gameData.CheckTriggeredEvent(idsData))
     {
         triggerData.isTrigger = true;
     }
     else
     {
         triggerData.isTrigger = false;
     }
 }
示例#3
0
    /// <summary>
    /// 获取触发条件详情 结婚
    /// </summary>
    /// <param name="triggerData"></param>
    /// <param name="gameData"></param>
    private static void GetTriggerDetailsForMarry(EventTriggerBean triggerData, GameDataBean gameData)
    {
        FamilyDataBean familyData = gameData.GetFamilyData();

        if (familyData.CheckIsMarryDay(gameData.gameTime))
        {
            triggerData.isTrigger = true;
        }
        else
        {
            triggerData.isTrigger = false;
        }
    }
示例#4
0
    /// <summary>
    ///  获取触发条件详情 日期
    /// </summary>
    /// <param name="triggerData"></param>
    /// <param name="date"></param>
    private static void GetTriggerDetailsForDate(EventTriggerBean triggerData, int date)
    {
        int triggerDate = int.Parse(triggerData.triggerData);

        //如果没有设置日期 则默认触发
        if (triggerDate == 0)
        {
            triggerData.isTrigger = true;
            return;
        }
        if (triggerDate == date)
        {
            triggerData.isTrigger = true;
        }
        else
        {
            triggerData.isTrigger = false;
        }
    }
示例#5
0
    /// <summary>
    /// 获取触发条件详情 好感
    /// </summary>
    /// <param name="triggerData"></param>
    /// <param name="gameData"></param>
    private static void GetTriggerDetailsForFavorability(EventTriggerBean triggerData, GameDataBean gameData)
    {
        long[] favorabilityData = StringUtil.SplitBySubstringForArrayLong(triggerData.triggerData, ',');
        CharacterFavorabilityBean characterFavorability = gameData.GetCharacterFavorability(favorabilityData[0]);

        if (characterFavorability == null)
        {
            triggerData.isTrigger = false;
        }
        else
        {
            if (characterFavorability.favorabilityLevel < favorabilityData[1])
            {
                triggerData.isTrigger = false;
            }
            else
            {
                triggerData.isTrigger = true;
            }
        }
    }