using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;

public class WelfareOnLineItemInfo
{
    public int _TotalTime;
    public int _PassedTime;
    public int _ItemId;
    public int _ItemCount;
    public int _SubNodeState;
    public bool _IsCountTime;
    public int _NodeId;
    public int _SubNodeId;

    public WelfareOnLineItemInfo(int totalTime, int passedTime, int itemId, int itemCount, int subNodeState, int isCountTime, int nodeId, int subNodeId)
    {
        _TotalTime = totalTime;
        _PassedTime = passedTime;
        _ItemId = itemId;
        _ItemCount = itemCount;
        _SubNodeState = subNodeState;
        _IsCountTime = isCountTime == 1;
        _NodeId = nodeId;
        _SubNodeId = subNodeId;
    }

    internal int InitBtnDesc()
    {
        throw new NotImplementedException();
    }
}

public class WelfareOnLineCtr : WelfarePageBaseCS{
    public static WelfareOnLineCtr Instance;
    void Awake()
    {
        Instance = this;
    }

    private void OnDestroy()
    {
        Instance = null;
    }

    public override void OnPacketRec(NodePageInfoRet packet)
    {
        base.OnPacketRec(packet);

        List<WelfareOnLineItemInfo> infoList = new List<WelfareOnLineItemInfo>();
        for (int index = 0; index < packet._SubNodeList.Count; index++)
        {
            WelfareOnLineItemInfo info = new WelfareOnLineItemInfo(
                packet._SubNodeList[index]._TotalTime,
                packet._SubNodeList[index]._PassedTime,
                packet._SubNodeList[index]._RewList[0]._ItemId,
                packet._SubNodeList[index]._RewList[0]._ItemNum,
                packet._SubNodeList[index]._SubNodeState,
                packet._SubNodeList[index]._IsCounTime,
                packet._NodeId,
                packet._SubNodeList[index]._SubNodeId);
            infoList.Add(info);
        }

        _SubNodeContainer.InitContentItem(infoList);
    }

}