Exemplo n.º 1
0
        public void CorgiCanBrushSelf()
        {
            Corgi  testCorgi   = new Corgi();
            string testMessage = testCorgi.BrushSelf();

            Assert.Equal("The " + testCorgi.AnimalName + " is brushing their own coat.", testMessage);
        }
Exemplo n.º 2
0
    public void Start(Corgi _corgi)
    {
        corgi = _corgi;

        var path = Path.Combine(Application.persistentDataPath, INIT_DATA_PATH);

        if (!File.Exists(path))
        {
            return;
        }

        var content = File.ReadAllText(path);

        if (string.IsNullOrEmpty(content))
        {
            return;
        }

        var initData = JsonConvert.DeserializeObject <CorgiDiskData>(content);

        if (initData == null)
        {
            return;
        }

        chunkData          = initData.chunkData;
        chunkPriorityQueue = initData.chunkPriorityQueue;
        capacity           = initData.capacity;
        useSize            = initData.useSize;
    }
Exemplo n.º 3
0
        public void CorgiCanEat()
        {
            Corgi  testCorgi   = new Corgi();
            string testMessage = testCorgi.Eat();

            Assert.Equal("The " + testCorgi.AnimalName + " is eating some kibble.", testMessage);
        }
Exemplo n.º 4
0
        public void CorgiCanFlop()
        {
            Corgi  testCorgi   = new Corgi();
            string testMessage = testCorgi.Flop();

            Assert.Equal("The corgi flops on the ground.", testMessage);
        }
Exemplo n.º 5
0
        public void CorgiCanWalk()
        {
            Corgi  testCorgi   = new Corgi();
            string testMessage = testCorgi.Walk();

            Assert.Equal("Please walk the " + testCorgi.AnimalName + ".", testMessage);
        }
Exemplo n.º 6
0
        public void CorgiCanBark()
        {
            Corgi  testCorgi   = new Corgi();
            string testMessage = testCorgi.Bark();

            Assert.Equal("The " + testCorgi.AnimalName + " barks quietly.", testMessage);
        }
Exemplo n.º 7
0
 void Start()
 {
     ChangeImageIndex(0);
     button.onClick.AddListener(NextUrl);
     Corgi.Memorize(urls.Select(x => new CorgiMemorize()
     {
         url = x, version = 0
     }).ToList());
 }
Exemplo n.º 8
0
        public void AnimalCanWalkFromCorgi()
        {
            Corgi  testCorgi     = new Corgi();
            string testMessage   = testCorgi.Walk();
            Animal testAnimal    = new Corgi();
            string animalMessage = testAnimal.Walk();

            Assert.Equal(animalMessage, testMessage);
        }
Exemplo n.º 9
0
        public void MammalCanBrushSelfFromCorgi()
        {
            Corgi  testCorgi     = new Corgi();
            string testMessage   = testCorgi.BrushSelf();
            Mammal testMammal    = new Corgi();
            string mammalMessage = testMammal.BrushSelf();

            Assert.Equal(mammalMessage, testMessage);
        }
Exemplo n.º 10
0
        public void DogCanEatFromCorgi()
        {
            Corgi  testCorgi   = new Corgi();
            string testMessage = testCorgi.Eat();
            Dog    testDog     = new Corgi();
            string dogMessage  = testDog.Eat();

            Assert.Equal(dogMessage, testMessage);
        }
Exemplo n.º 11
0
        public void CorgiCanGrowSecondCoatBrushSelf()
        {
            Corgi testCorgi = new Corgi();

            testCorgi.HasTwoCoats = true;
            string testMessage = testCorgi.BrushSelf();

            Assert.Equal("The " + testCorgi.AnimalName + " is brushing their own coat. The " + testCorgi.AnimalName + "'s second coat sheds.", testMessage);
        }
Exemplo n.º 12
0
    void ChangeImageIndex(int _index)
    {
        if (index == _index)
        {
            return;
        }

        button.enabled = false;
        index          = _index;
        startTime      = DateTime.Now;
        Corgi.Fetch(urls[index], 0, OnFetchDone);
        Corgi.Fallback(OnFetchFailed);
    }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            GermanShepherd gshepherd = new GermanShepherd();
            Corgi          corgi     = new Corgi();
            Dog            corgi1    = new Corgi();
            Lablador       lablador  = new Lablador();

            Console.WriteLine("Germanshepherd-Szczekanie:" + gshepherd.Bark() + " Warczenie:" + gshepherd.Growl());
            Console.WriteLine("Corgi:" + corgi.Bark());
            Console.WriteLine("Inny typ:" + corgi1.Bark());
            Console.WriteLine("Lablador-Szczekanie:" + lablador.Bark() + " Warczenie:" + lablador.Growl());


            Console.ReadKey();
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            GermanShepherd shepherd = new GermanShepherd();

            Corgi corgi  = new Corgi();
            Dog   corgi1 = new Corgi();
            Puppy puppy  = new Puppy();

            Console.WriteLine("Germanshepherd-Szczekanie:" + shepherd.Bark() + " Warczenie:" + shepherd.Growl());
            Console.WriteLine("Typ Corgi:" + corgi.Bark());
            Console.WriteLine("Inny typ:" + corgi1.Bark());

            Console.WriteLine("Szczeniak:" + "Warczenie:" + puppy.Growl() + " Szczekanie:" + puppy.Bark());


            Console.ReadKey();
        }
Exemplo n.º 15
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }

        DontDestroyOnLoad(this);

        corgiLayers = new List <ICorgiLayer>()
        {
            new CorgiMemory(), new CorgiDisk(), new CorgiWeb()
        };

        foreach (var corgiLayer in corgiLayers)
        {
            corgiLayer.Start(this);
        }
    }
Exemplo n.º 16
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        DontDestroyOnLoad(this);

        mainThreadId    = Thread.CurrentThread.ManagedThreadId;
        handles         = new Dictionary <string, CacheHandle>();
        mainThreadTasks = new List <Action>();

        disk   = gameObject.AddComponent <CorgiDisk>();
        memory = gameObject.AddComponent <CorgiMemory>();
        web    = gameObject.AddComponent <CorgiWeb>();

        var path = Path.Combine(Application.persistentDataPath, IndexFilename);

        if (!File.Exists(path))
        {
            return;
        }

        var content = File.ReadAllText(path);

        Debug.Log("Awake Data" + content);

        if (string.IsNullOrEmpty(content))
        {
            return;
        }

        var initData = JsonConvert.DeserializeObject <CorgiDiskData>(content);

        if (initData == null)
        {
            return;
        }

        disk.Init(initData);
    }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Corgi   ein   = new Corgi();
            Samoyed sam   = new Samoyed();
            Pidgeon pete  = new Pidgeon();
            Eagle   ethan = new Eagle();
            Snake   sal   = new Snake();
            Dragon  dan   = new Dragon();

            Console.WriteLine("Meet Ein the " + ein.AnimalName + ".");
            ein.Eat();
            ein.Sleep();
            ein.Walk();
            ein.BrushSelf();
            ein.Bark();
            ein.Flop();
            Console.WriteLine("\nMeet Sam the " + sam.AnimalName + ".");
            sam.Eat();
            sam.Sleep();
            sam.Walk();
            sam.BrushSelf();
            sam.Bark();
            sam.SamoyedEat();
            sam.RollOver();
            Console.WriteLine("\nMeet Pete the " + pete.AnimalName + ".");
            pete.Eat();
            pete.Sleep();
            pete.Walk();
            pete.Flap();
            pete.TakeOff();
            pete.TakeOff();
            pete.Land("home");
            pete.Land("elseswhere");
            pete.Coo();
            Console.WriteLine("\nMeet Ethan the " + ethan.AnimalName + ".");
            ethan.Eat();
            ethan.Sleep();
            ethan.Walk();
            ethan.Flap();
            ethan.Hunt("snake");
            ethan.TakeOff();
            ethan.Land("the zoo");
            Console.WriteLine("\nMeet Sal the " + sal.AnimalName + ".");
            sal.StopHibernating();
            sal.Eat();
            sal.Sleep();
            sal.Walk();
            sal.Firebreath();
            sal.StartHibernating();
            sal.StopHibernating();
            Console.WriteLine("\nFinally, meet Dan the " + dan.AnimalName + ".");
            dan.Eat();
            dan.Sleep();
            dan.Walk();
            dan.Firebreath();
            dan.Fly();
            dan.TakeOff();
            dan.Land("your car");
            dan.StartHibernating();
            Console.WriteLine("\nThank you for visiting the zoo.");
        }
Exemplo n.º 18
0
 public void Start(Corgi _corgi)
 {
     corgi = _corgi;
 }