Пример #1
0
 public void UpdateState(COM_State state)
 {
     for (int i = 0; i < buffList_.Count; ++i)
     {
         if (buffList_[i].stateId_ == state.stateId_)
         {
             buffList_[i] = state;
             // if (OnStateUpdate != null)
             //   OnStateUpdate();
             break;
         }
     }
 }
Пример #2
0
    public void AddState(COM_State state)
    {
        buffList_.Add(state);
        //for (int i = 0; i < buffList_.Count; ++i)
        //{
        //    if (buffList_[i] == null)
        //    {
        //        buffList_[i] = state;
        //  if (OnStateUpdate != null)
        //    OnStateUpdate();

        //        break;
        //    }
        //}
    }
Пример #3
0
    public StateCellUI AddStateCellUI(UISprite parent, COM_State stateInst = null, float offsetX = 0f, float offsetY = 0f)
    {
        StateCellUI[] cells = parent.gameObject.GetComponentsInChildren <StateCellUI>(true);
        StateCellUI   cell  = null;

        if (cells == null || cells.Length == 0)
        {
            cell = InstantiateStateCellUIObj();
            if (stateInst != null)
            {
                cell.cellPane.transform.parent        = parent.gameObject.transform;
                cell.cellPane.depth                   = parent.depth + 1;
                cell.cellPane.transform.localPosition = new Vector2(offsetX, offsetY);
                cell.cellPane.transform.localScale    = Vector3.one;
            }
        }
        else
        {
            cell = cells[0];
        }
        cell.stateInst = stateInst;
        return(cell);
    }