コード例 #1
0
    public override void DrawCell(int index, int count = 0)
    {
        base.DrawCell(index, count);
        var dataList = dynamicPackage.GetVisibleEventList();

        if (index >= dataList.Count)
        {
            return;
        }
        NWorldEventInfo info = dataList[index];

        var          configMap = ConfigDataStatic.GetConfigDataTable("WORLD_EVENTS");
        WORLD_EVENTS config    = configMap[info.configID] as WORLD_EVENTS;

        titleLabel.text   = config.EventName;
        contentLabel.text = config.EventNews;
        endTime           = info.happenTime + config.EventDuration * 60 * 1000;
        //print(string.Format("{0}, {1}, {2}", config.EventName, GlobalFunction.DateFormat(info.happenTime), GlobalFunction.DateFormat(endTime)));
        if (GlobalFunction.IsHappened(info.happenTime))
        {
            ShowTime(endTime, true);
        }
        else
        {
            ShowTime(info.happenTime, false);
        }
    }
コード例 #2
0
    //get item history price
    public void CalculateGraphInfo(int configID, long startTime, long curTime)
    {
        mGraphInfoList.Clear();
        EventPackage           eventPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_Event) as EventPackage;
        ItemPackage            itemPackage  = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_Item) as ItemPackage;
        ITEM_RES               itemConfig   = itemPackage.GetItemDataByConfigID(configID);
        List <NWorldEventInfo> eventList    = eventPackage.GetHistoryEventList();
        string itemKeyName = itemConfig.KeyName;

        itemKeyName = char.ToUpper(itemKeyName[0]) + itemKeyName.Substring(1).ToLower();

        //reflection
        System.Type  type = System.Type.GetType("com.nkm.framework.resource.data." + "WORLD_EVENTS");
        PropertyInfo itemPriceProperty = type.GetProperty(itemKeyName);
        PropertyInfo itemHasProperty   = type.GetProperty("Has" + itemKeyName);

        NGraphNode preNode = null;
        NGraphNode node    = null;

        //add start node
        node       = new NGraphNode();
        node.price = (double)itemConfig.GoldConv / 1000d;
        node.time  = startTime;
        mGraphInfoList.Add(node);

        for (int i = 0; i < eventList.Count; i++)
        {
            NWorldEventInfo info        = eventList[i];
            WORLD_EVENTS    eventConfig = eventPackage.GetEventConfigDataByConfigID(info.configID);
            bool            isHas       = (bool)itemHasProperty.GetValue(eventConfig, null);
            if (!isHas)
            {
                continue;
            }
            double priceArgs = System.Convert.ToDouble(itemPriceProperty.GetValue(eventConfig, null)) / 100;

            if (info.happenTime <= startTime)
            {
                node        = mGraphInfoList[0];
                node.price *= priceArgs;
            }
            else
            {
                preNode = mGraphInfoList[mGraphInfoList.Count - 1];
                node    = new NGraphNode();
                if (info.isHappen)
                {
                    node.price = preNode.price * priceArgs;
                }
                else
                {
                    node.price = preNode.price / priceArgs;
                }
                mGraphInfoList.Add(node);
            }
        }
    }
コード例 #3
0
ファイル: EventPackage.cs プロジェクト: Wen1995/Project60D
 public void SetHistoryEvent(TSCGetWorldEvent res)
 {
     historyEventList.Clear();
     for (int i = 0; i < res.WorldEventsCount; i++)
     {
         WorldEvent      info    = res.GetWorldEvents(i);
         NWorldEventInfo newInfo = new NWorldEventInfo();
         newInfo.configID   = info.ConfigId;
         newInfo.happenTime = info.Time;
         newInfo.isHappen   = info.Type == 1 ? true : false;
         historyEventList.Add(newInfo);
     }
 }
コード例 #4
0
ファイル: EventPackage.cs プロジェクト: Wen1995/Project60D
 public void SetWorldEvent(TSCHeart res)
 {
     curEventList.Clear();
     futureEventList.Clear();
     for (int i = 0; i < res.WorldEventConfigId2HappenTimeCount; i++)
     {
         NWorldEventInfo info = new NWorldEventInfo(res.GetWorldEventConfigId2HappenTime(i));
         Debug.Log(info.configID);
         if (GlobalFunction.IsHappened(info.happenTime))
         {
             curEventList.Add(info);
         }
         else
         {
             futureEventList.Add(info);
         }
     }
     FacadeSingleton.Instance.SendEvent("RefreshEvent");
 }
コード例 #5
0
ファイル: EventPackage.cs プロジェクト: Wen1995/Project60D
    public bool IsVisible(NWorldEventInfo info)
    {
        SanctuaryPackage sanctuaryPackage = FacadeSingleton.Instance.RetrieveData(ConstVal.Package_Sanctuary) as SanctuaryPackage;
        int level = sanctuaryPackage.GetBuildingLevelByType(BuildingType.RadioStation);
        int diff  = 0;

        if (level > 0)
        {
            WUXIANDIAN config = ConfigDataStatic.GetConfigDataTable("WUXIANDIAN")[level] as WUXIANDIAN;
            diff = config.WuxiandianDis;
        }
        long remainTime;

        if (GlobalFunction.GetRemainTime(info.happenTime, out remainTime))
        {
            if (diff * 1000 >= remainTime)
            {
                return(true);
            }
            return(false);
        }
        return(false);
    }