Author Topic: Data binding on non monobehaviour  (Read 1370 times)

vikti

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 25
    • View Profile
Data binding on non monobehaviour
« on: December 18, 2014, 05:33:30 PM »
Hello,

I wonder how to do a data binding on a non behaviour class.

Ex :

  1.         public class Item{
  2.                 public int Id {get;set;}
  3.                 public Vector2 GeoCoord{get;set;}
  4.                 public string State{get;set;}
  5.                 public string Name{get;set;}
  6.                 public Type Type{get;set;}
  7.                 public string Icon{get;set;}
  8.                 public int Aura{get;set;}
  9.                 public Dictionary<string, int> GOInstanceId{get;set;}
  10.                 private int ownerId;
  11.                 public int OwnerId{
  12.                         get{
  13.                                 return ownerId;
  14.                         }
  15.                         set{
  16.                                 ownerId = value;
  17.                                 switch(ownerId){
  18.                                         case -1 :       State = "deleted";
  19.                                                                 break;
  20.                                         case 0  :       State = "invisible";
  21.                                                                 break;
  22.                                         case 1  :       State = "free";
  23.                                                                 break;
  24.                                         default :       State = "owned";
  25.                                                                 break;
  26.                                 }
  27.                         }
  28.                 }
  29.                 public Item (){
  30.                         GOInstanceId = new Dictionary<string,int>();
  31.                 }
  32.         }

Then I have some view elements : map markers, details info panels with input text, labels...

Is it possible to link this element with the model ?