public IslandTargetGroupMMOItem(IMMOItem sfsItem)
 {
     Path    = sfsItem.GetVariable(SocketItemVars.GAME_OBJECT_PATH.GetKey()).GetStringValue();
     Expires = long.Parse(sfsItem.GetVariable(SocketItemVars.STATE_TIMESTAMP.GetKey()).GetStringValue());
     if (sfsItem.ContainsVariable(SocketItemVars.TIMESTAMP.GetKey()))
     {
         Starts = long.Parse(sfsItem.GetVariable(SocketItemVars.TIMESTAMP.GetKey()).GetStringValue());
     }
 }
 private int getBestWinStreakToday(IMMOItem sfsItem)
 {
     if (sfsItem.ContainsVariable(SocketItemVars.ACTION_COUNT.GetKey()))
     {
         return(sfsItem.GetVariable(SocketItemVars.ACTION_COUNT.GetKey()).GetIntValue());
     }
     return(0);
 }
 private int getCurrentWinStreakToday(IMMOItem sfsItem)
 {
     if (sfsItem.ContainsVariable(SocketItemVars.INTEGER_A.GetKey()))
     {
         return(sfsItem.GetVariable(SocketItemVars.INTEGER_A.GetKey()).GetIntValue());
     }
     return(0);
 }
 private string getPath(IMMOItem sfsItem)
 {
     if (sfsItem.ContainsVariable(SocketItemVars.GAME_OBJECT_PATH.GetKey()))
     {
         return(sfsItem.GetVariable(SocketItemVars.GAME_OBJECT_PATH.GetKey()).GetStringValue());
     }
     return(string.Empty);
 }
 public override void UpdateData(User user, List <string> changedVars, IMMOItem item)
 {
     if (item != null && _bullets.ContainsKey(item.Id))
     {
         float x = 0; float y = 0;
         if (item.ContainsVariable(Consts.X))
         {
             x = (float)item.GetVariable(Consts.X).GetIntValue();
         }
         if (item.ContainsVariable(Consts.Y))
         {
             y = (float)item.GetVariable(Consts.Y).GetIntValue();
         }
         _bullets[item.Id].SetPosition(new Vector2(x, y));
     }
     base.UpdateData(user, changedVars, item);
 }
    public static CPMMOItem Create(IMMOItem sfsItem, Func <int?, long> sessionIdMapper)
    {
        ItemCategory intValue = (ItemCategory)sfsItem.GetVariable(SocketItemVars.CATEGORY.GetKey()).GetIntValue();
        CPMMOItem    cPMMOItem;

        switch (intValue)
        {
        case ItemCategory.Consumable:
            cPMMOItem = createConsumableItem(sfsItem);
            break;

        case ItemCategory.ScheduledRoomObject:
            cPMMOItem = createStatefulWorldObject(sfsItem);
            break;

        case ItemCategory.IslandTarget:
            cPMMOItem = createIslandTargetMMOItem(sfsItem);
            break;

        case ItemCategory.IslandTargetGroup:
            cPMMOItem = createIslandTargetGroupMMOItem(sfsItem);
            break;

        case ItemCategory.IslandTargetPlaygroundStats:
            cPMMOItem = createIslandTargetPlaygroundStatsMMOItem(sfsItem);
            break;

        case ItemCategory.PartyGamelobby:
            cPMMOItem = createPartyGameLobbyMMOItem(sfsItem);
            break;

        case ItemCategory.DanceBattle:
            cPMMOItem = createDanceBattleMMOItem(sfsItem);
            break;

        default:
            cPMMOItem = new CPMMOItem();
            Log.LogError(typeof(CPMMOItem), "Unknown item category: " + intValue);
            break;
        }
        cPMMOItem.Id        = new CPMMOItemId(sfsItem.Id, CPMMOItemId.CPMMOItemParent.WORLD);
        cPMMOItem.CreatorId = sessionIdMapper(sfsItem.GetVariable(SocketItemVars.CREATOR.GetKey()).GetIntValue());
        return(cPMMOItem);
    }
示例#7
0
        private int getGameTemplateId(IMMOItem sfsItem)
        {
            int result = 0;

            if (sfsItem.ContainsVariable(SocketItemVars.INTEGER_A.GetKey()))
            {
                result = sfsItem.GetVariable(SocketItemVars.INTEGER_A.GetKey()).GetIntValue();
            }
            return(result);
        }
示例#8
0
        private long getTimeToLiveInSeconds(IMMOItem sfsItem)
        {
            long result = 0L;

            if (sfsItem.ContainsVariable(SocketItemVars.TIME_TO_LIVE.GetKey()))
            {
                result = sfsItem.GetVariable(SocketItemVars.TIME_TO_LIVE.GetKey()).GetIntValue();
            }
            return(result);
        }
示例#9
0
        private long getTimeStartedInSecondsSinceEpoc(IMMOItem sfsItem)
        {
            long result = 0L;

            if (sfsItem.ContainsVariable(SocketItemVars.STATE_TIMESTAMP.GetKey()))
            {
                result = long.Parse(sfsItem.GetVariable(SocketItemVars.STATE_TIMESTAMP.GetKey()).GetStringValue());
            }
            return(result);
        }
示例#10
0
    private string getTurnOutcomeDanceMoveData(IMMOItem sfsItem)
    {
        string result = string.Empty;

        if (sfsItem.ContainsVariable(SocketItemVars.DANCE_MOVE_DATA.GetKey()))
        {
            result = sfsItem.GetVariable(SocketItemVars.DANCE_MOVE_DATA.GetKey()).GetStringValue();
        }
        return(result);
    }
示例#11
0
    private string getTurnData(IMMOItem sfsItem)
    {
        string result = string.Empty;

        if (sfsItem.ContainsVariable(SocketItemVars.TURN_DATA.GetKey()))
        {
            result = sfsItem.GetVariable(SocketItemVars.TURN_DATA.GetKey()).GetStringValue();
        }
        return(result);
    }
示例#12
0
 public override void Add(User user, IMMOItem item)
 {
     if (item != null && !_items.ContainsKey(item.Id))
     {
         // check type var contain inside item or not
         if (item.ContainsVariable(Consts.TYPE))
         {   // check type is bullet
             int type = item.GetVariable(Consts.TYPE).GetIntValue();
             if (type == Consts.ES_ITEM_ARMOR || type == Consts.ES_ITEM_ISVISIABLE || type == Consts.ES_ITEM_FREZZE)
             {
                 if (item.ContainsVariable(Consts.X) && item.ContainsVariable(Consts.Y))
                 {
                     _items.Add(item.Id, new Item((float)item.GetVariable(Consts.X).GetIntValue(),
                                                  (float)item.GetVariable(Consts.Y).GetIntValue(),
                                                  type));
                     _items[item.Id].LoadContents(_contents);
                 }
             }
         }
     }
     base.Add(user, item);
 }
 public override void Add(User user, IMMOItem item)
 {
     if (item != null && !_bullets.ContainsKey(item.Id))
     {
         // check type var contain inside item or not
         if (item.ContainsVariable(Consts.TYPE))
         {   // check type is bullet
             if (item.GetVariable(Consts.TYPE).GetIntValue() == Consts.ES_BULLET)
             {
                 if (item.ContainsVariable(Consts.X) && item.ContainsVariable(Consts.Y))
                 {
                     _bullets.Add(item.Id, new Bullet((float)item.GetVariable(Consts.X).GetIntValue(),
                                                      (float)item.GetVariable(Consts.Y).GetIntValue(),
                                                      (ulong)item.Id));
                     _bullets[item.Id].LoadContents(_contents);
                     Debug.WriteLine("Added bullet " + item.Id);
                 }
             }
         }
     }
     base.Add(user, item);
 }
    private static ConsumableItem createConsumableItem(IMMOItem sfsItem)
    {
        string         stringValue = sfsItem.GetVariable(SocketItemVars.TEMPLATE.GetKey()).GetStringValue();
        ConsumableItem consumableItem;

        switch (stringValue)
        {
        case "timed":
            consumableItem = new TimedItem(sfsItem);
            break;

        case "actioned":
            consumableItem = new ActionedItem(sfsItem);
            break;

        default:
            consumableItem = new ConsumableItem();
            Log.LogError(typeof(CPMMOItem), "Unknown consumable template: " + stringValue);
            break;
        }
        consumableItem.Type = sfsItem.GetVariable(SocketItemVars.TYPE.GetKey()).GetStringValue();
        return(consumableItem);
    }
示例#15
0
 public override void UpdateData(User user, List <string> changedVars, IMMOItem item)
 {
     if (item != null && _items.ContainsKey(item.Id))
     {
         if (item.ContainsVariable(Consts.TYPE))
         {
             int type = item.GetVariable(Consts.TYPE).GetIntValue();
             if (type == Consts.ES_ITEM_FREZZE ||
                 type == Consts.ES_ITEM_ARMOR ||
                 type == Consts.ES_ITEM_ISVISIABLE)
             {
                 if (item.ContainsVariable(Consts.COUNT_DOWN))
                 {
                     bool isCountDown = item.GetVariable(Consts.COUNT_DOWN).GetBoolValue();
                     if (isCountDown)
                     {
                         _items[item.Id].Behavior(Consts.COUNT_DOWN);
                     }
                 }
             }
         }
     }
     base.UpdateData(user, changedVars, item);
 }
示例#16
0
 private void RemovePlayer(IMMOItem item)
 {
     string id = item.GetVariable ("id").GetStringValue ();
             Debug.Log ("Removing player " + id);
             mobs.Remove (id);
 }
示例#17
0
 public IslandTargetMMOItem(IMMOItem sfsItem)
 {
     Path        = sfsItem.GetVariable(SocketItemVars.GAME_OBJECT_PATH.GetKey()).GetStringValue();
     HitCapacity = sfsItem.GetVariable(SocketItemVars.INTEGER_A.GetKey()).GetIntValue();
     HitCount    = sfsItem.GetVariable(SocketItemVars.ACTION_COUNT.GetKey()).GetIntValue();
 }
示例#18
0
 private void AddWall(IMMOItem item)
 {
     float x = item.AOIEntryPoint.FloatX;
             float y = item.AOIEntryPoint.FloatY;
             int w = item.GetVariable ("w").GetIntValue ();
             int h = item.GetVariable ("h").GetIntValue ();
             string id = item.GetVariable ("id").GetStringValue ();
             if (!walls.ContainsKey (id)) {
                     GameObject obj = GameObject.CreatePrimitive (PrimitiveType.Cube);
                     obj.AddComponent<Controller> ();
                     walls.Add (id, obj);
             }
             GameObject wall = walls [id];
             wall.transform.position = new Vector3 (x, y, 0);
             wall.transform.localScale = new Vector3 (w, h, 1);
 }
示例#19
0
 private void RemoveItem(IMMOItem item)
 {
     string id = item.GetVariable ("id").GetStringValue ();
             Debug.Log ("Removing item " + id);
             items.Remove (id);
 }
示例#20
0
 private void AddPlayer(IMMOItem item)
 {
     float x = item.AOIEntryPoint.FloatX;
             float y = item.AOIEntryPoint.FloatY;
             string id = item.GetVariable ("id").GetStringValue ();
             int speed = item.GetVariable ("s").GetIntValue ();
             int direction = item.GetVariable ("d").GetIntValue ();
             if (!mobs.ContainsKey (id)) {
                     mobs.Add (id, GameObject.Instantiate (playerModel) as GameObject);
             }
             GameObject mob = mobs [id];
             PlayerController controller = mob.GetComponent<PlayerController> ();
             controller.UUID = id;
             // controller.Speed = speed;
             // controller.Direction = direction;
             controller.Position (x, y);
 }
示例#21
0
 private void AddItem(IMMOItem item)
 {
     float x = item.AOIEntryPoint.FloatX;
             float y = item.AOIEntryPoint.FloatY;
             string id = item.GetVariable ("id").GetStringValue ();
             if (!items.ContainsKey (id)) {
                     items.Add (id, GameObject.Instantiate (foodModel) as GameObject);
             }
             GameObject gameItem = items [id];
             Controller controller = gameItem.GetComponent<Controller> ();
             controller.UUID = id;
             controller.Position (x, y);
 }
示例#22
0
 public TimedItem(IMMOItem sfsItem)
 {
     TimeToLive = (float)sfsItem.GetVariable(SocketItemVars.TIME_TO_LIVE.GetKey()).GetDoubleValue();
 }
 public StatefulWorldObject(IMMOItem sfsItem)
 {
     Path      = sfsItem.GetVariable(SocketItemVars.GAME_OBJECT_PATH.GetKey()).GetStringValue();
     Timestamp = long.Parse(sfsItem.GetVariable(SocketItemVars.STATE_TIMESTAMP.GetKey()).GetStringValue());
     State     = (ScheduledWorldObjectState)sfsItem.GetVariable(SocketItemVars.SCHEDULED_WORLD_OBJECT_STATE.GetKey()).GetIntValue();
 }
示例#24
0
 public ActionedItem(IMMOItem sfsItem)
     : base(sfsItem)
 {
     ActionCount = sfsItem.GetVariable(SocketItemVars.ACTION_COUNT.GetKey()).GetIntValue();
 }