Beispiel #1
0
        public void DoAction()
        {
            if (!Launched)
            {
                return;
            }
            IMapChangement mapChangement = null;

            if (PathData.ContainsKey(Account.Character.MapId))
            {
                switch (PathData[Account.Character.MapId].Item2)
                {
                case "move":
                    Logger.Default.Log($"[PathManager] Déplacement vers {PathData[Account.Character.MapId].Item1}",
                                       LogMessageType.Info);
                    mapChangement = Account.Character.Map.ChangeMap(PathData[Account.Character.MapId].Item1);
                    break;

                case "gather":
                    if (Account.Character.GatherManager.CanGatherOnMap(RessourcesToGather))
                    {
                        Logger.Default.Log("Lancement de la récolte");
                        Account.Character.GatherManager.Gather(RessourcesToGather, false);
                        break;
                    }
                    Logger.Default.Log("Rien a récolter");
                    mapChangement = Account.Character.Map.ChangeMap(PathData[Account.Character.MapId].Item1);
                    break;

                case "fight":
                    Logger.Default.Log("[PathManager] Combat non géré", LogMessageType.Public);
                    mapChangement = Account.Character.Map.ChangeMap(PathData[Account.Character.MapId].Item1);
                    break;
                }
            }
            else
            {
                Logger.Default.Log($"Map {Account.Character.MapId} non gérée dans le trajet");
            }

            if (mapChangement == null)
            {
                return;
            }
            mapChangement.ChangementFinished += delegate(object sender, MapChangementFinishedEventArgs args)
            {
                Logger.Default.Log($"Changement de map {args.Success}");
            };
            mapChangement.PerformChangement();
        }
Beispiel #2
0
 protected T GetPathDataValue <T>(string key, T defaultValue = default(T))
 {
     if (PathData.ContainsKey(key))
     {
         Type type  = typeof(T);
         var  value = PathData[key];
         if (RequestBinder.Contains(type))
         {
             return((T)RequestBinder.GetBinder(type).Bind(value, type, defaultValue));
         }
         else if (type.IsEnum)
         {
             return((T)RequestBinder.GetBinder(typeof(Enum)).Bind(value, type, defaultValue));
         }
     }
     return(defaultValue);
 }