Beispiel #1
0
 public ButtonAttribute(string name, ESize size, EColor colorType)
 {
     Name     = name;
     SizeType = size;
     Style    = GetGUIStyle();
     BgColor  = ParseColorType(colorType);
 }
Beispiel #2
0
 public ButtonAttribute(string name, ESize size)
 {
     Name     = name;
     SizeType = size;
     Style    = GetGUIStyle();
     BgColor  = Color.white;
 }
        public ActionResult Index(bool goodWithChildren, bool drools, ELength coatlength,
                                  EScale activityLevel, EScale sheddingLevel, EScale groomingLevel,
                                  EScale intelligenceLevel, ESize size)
        {
            Dog requestedDog = new Dog
            {
                GoodWithChildren  = goodWithChildren,
                Drools            = drools,
                Coatlength        = coatlength,
                ActivityLevel     = activityLevel,
                SheddingLevel     = sheddingLevel,
                GroomingLevel     = groomingLevel,
                IntelligenceLevel = intelligenceLevel,
                Size = size
            };
            Dog returnDog = findDogRecommendation(requestedDog);

            if (returnDog.BreedName != null)
            {
                return(View("DogRecommendation", returnDog));
            }
            else
            {
                return(View("NoDogRecommendation"));
            }
        }
Beispiel #4
0
 public ButtonAttribute(string name, ESize size, float colorR, float colorG, float colorB)
 {
     Name     = name;
     SizeType = size;
     Style    = GetGUIStyle();
     BgColor  = new Color(colorR, colorG, colorB);
 }
Beispiel #5
0
        private Boolean AddViewWithPreviousSlot(IMoveable go, ESize size, out Vector3 localPosition, Int32 p_comeFrom, EntityPositioning p_oldPositioning)
        {
            Boolean searchNearestSlot = false;

            if (p_oldPositioning != null)
            {
                EDirection direction = EDirectionFunctions.GetDirection(p_oldPositioning.Position, m_gridSlot.Position);
                if (direction != m_direction && direction != EDirectionFunctions.Add(m_direction, 2))
                {
                    searchNearestSlot = true;
                }
            }
            Boolean flag;

            if (size == ESize.MEDIUM)
            {
                flag = AddViewWithPreviousSlotMedium(go, out localPosition, p_comeFrom, p_oldPositioning, searchNearestSlot);
            }
            else if (size == ESize.BIG)
            {
                flag = AddViewWithPreviousSlotBig(go, out localPosition, p_comeFrom);
            }
            else
            {
                flag = AddViewWithPreviousSlotSmall(go, out localPosition, p_comeFrom, p_oldPositioning, searchNearestSlot);
            }
            return(!flag);
        }
Beispiel #6
0
    public FFT(ESize size)
    {
        N     = (int)size;
        log2N = (uint)Mathf.Log(N, 2);

        reversed = new NativeArray <uint>(N, Allocator.Persistent);
        time     = new NativeArray <Complex>(N * N, Allocator.Persistent);

        for (int i = 0; i < N; i++)
        {
            reversed[i] = ReverseBits((uint)i);
        }

        int pow2 = 1;

        for (int i = 0; i < log2N; i++)
        {
            for (int j = 0; j < pow2; j++)
            {
                float term = (Mathf.PI * 2) * j / (pow2 * 2);
                time[(i * N) + j] = new Complex(Mathf.Cos(term), Mathf.Sin(term));
            }

            pow2 *= 2;
        }
    }
 private bool checkSize(ESize dogQualitiesESizeValue, ESize currentDogESizeValue)
 {
     if (currentDogESizeValue.Equals(dogQualitiesESizeValue))
         return true;
     else
         return false;
 }
Beispiel #8
0
    public static List <GameObject> FindModulesBySize(ESize _eModuleSize)
    {
        if (!s_mModulesBySize.ContainsKey(_eModuleSize))
        {
            return(null);
        }

        return(s_mModulesBySize[_eModuleSize]);
    }
        private int determineBestMatch(bool GoodWithChildren, bool Drools, ELength Coatlength, ESize Size, EScale ActivityLevel, EScale SheddingLevel, EScale GroomingLevel, EScale IntelligenceLevel)
        {
            //Make a list to store score values. This is a way of assessing which dog is the best choice.
            int[] scores = new int[dogList.Count];

            for (int i = 0; i < dogList.Count; i++)
            {
                //For each matching criteria, increase a score value.
                //This completely hinges on the fact that dogs in the list ARE NOT SORTED.
                //The dog list has a very tenuous connection with the score list.
                if (dogList[i].GoodWithChildren == GoodWithChildren)
                {
                    scores[i]++;
                }
                if (dogList[i].Drools == Drools)
                {
                    scores[i]++;
                }
                if (dogList[i].Coatlength == Coatlength)
                {
                    scores[i]++;
                }
                if (dogList[i].Size == Size)
                {
                    scores[i]++;
                }
                if (dogList[i].ActivityLevel == ActivityLevel)
                {
                    scores[i]++;
                }
                if (dogList[i].SheddingLevel == SheddingLevel)
                {
                    scores[i]++;
                }
                if (dogList[i].GroomingLevel == GroomingLevel)
                {
                    scores[i]++;
                }
                if (dogList[i].IntelligenceLevel == IntelligenceLevel)
                {
                    scores[i]++;
                }
            }

            //Get max val
            int highScore = scores.Max();

            //Big Caveat:
            //This will return the index of the first dog that achieved that score.
            //It's quite common for multiple dogs to get the same score, so some dogs will be over-represented in practice.
            //This can be prevented by instead creating a list of dogs with equal scores and randomly selecting one from there as the
            //return dog. I felt it wasn't needed for the scope of this practical (also it's 11:30pm).
            int indexOf = scores.ToList().IndexOf(highScore);

            //Return index
            return indexOf;
        }
Beispiel #10
0
 public GridSlot()
 {
     m_transitions = new GridTransition[4];
     for (Int32 i = 0; i < m_transitions.Length; i++)
     {
         m_transitions[i] = new GridTransition();
     }
     m_Entities       = new List <MovingEntity>();
     m_EntitySpace    = ESize.BIG;
     m_spawnObjects   = new List <Spawn>();
     m_objects        = new List <InteractiveObject>();
     m_connections    = new GridSlot[4];
     m_availableSlots = new List <GridSlot>(4);
 }
        public ActionResult ChooseDogPref(bool GoodWithChildren, bool Drools, ELength Coatlength, ESize Size, EScale ActivityLevel, EScale SheddingLevel, EScale GroomingLevel, EScale IntelligenceLevel)
        {
            //Call makedatabase, populating a list of dogs
            dogList = makeDatabase();

            //Blank dog object, will be passed into the return view
            Dog recDog = dogList[0];

            //build a return dog by determining the index of the best match.
            int indexOfBest = determineBestMatch(GoodWithChildren, Drools, Coatlength, Size, ActivityLevel, SheddingLevel, GroomingLevel, IntelligenceLevel);
            recDog = dogList[indexOfBest];

            return View("DogConfirm", recDog);
        }
Beispiel #12
0
        //if values are the same assign 1
        //if it is not the same and it is 1 off either way
        // 0.5 is assigned because it is close
        public double getESizeValue(ESize wantedDogInput, ESize listDogInput)
        {
            double value = 0;

            if (wantedDogInput == listDogInput)
            {
                value = 1;
            }
            if (wantedDogInput == (listDogInput - 1) || wantedDogInput == (listDogInput + 1))
            {
                value = 0.5;
            }

            return(value);
        }
Beispiel #13
0
        public void Fill(String p_caption, String p_description, ESize p_size)
        {
            Single num  = m_outerPadding + m_innerPadding;
            Single num2 = 0f;
            Single horizontalScaleFactor;

            if (p_size == ESize.SMALL)
            {
                horizontalScaleFactor = 0.5f;
            }
            else if (p_size == ESize.MEDIUM)
            {
                horizontalScaleFactor = 0.75f;
            }
            else
            {
                horizontalScaleFactor = 1f;
            }
            Boolean flag = p_caption != String.Empty;

            m_caption.SetVisible(flag);
            if (flag)
            {
                m_caption.UpdatePositionY(-num);
                m_caption.HorizontalScaleFactor = horizontalScaleFactor;
                m_caption.UpdateText(p_caption);
                num += m_caption.Size.y + m_innerPadding;
                num2 = m_caption.Size.x;
            }
            Boolean flag2 = p_description != String.Empty;

            m_description.SetVisible(flag2);
            if (flag2)
            {
                m_description.UpdatePositionY(-num);
                m_description.HorizontalScaleFactor = horizontalScaleFactor;
                m_description.UpdateText(p_description);
                num += m_description.Size.y + m_innerPadding;
                num2 = m_description.Size.x;
            }
            m_background.Scale(num2 + m_outerPadding * 2f, num - m_innerPadding + m_outerPadding);
        }
        public ActionResult Result(EScale activityLevel, ELength coatlength, bool drools, bool goodWithChildren, EScale groomingLevel, EScale intelligenceLevel, EScale sheddingLevel, ESize size)
        {
            List<Dog> dogs = makeDatabase(); //gets dogs databse

            //creates dog with properties submitted in by user in html form
            Dog userDog = new Dog();
            userDog.ActivityLevel = activityLevel;
            userDog.Coatlength = coatlength;
            userDog.Drools = drools;
            userDog.GoodWithChildren = goodWithChildren;
            userDog.GroomingLevel = groomingLevel;
            userDog.IntelligenceLevel = intelligenceLevel;
            userDog.SheddingLevel = sheddingLevel;
            userDog.Size = size;

            //userDog is set to its best match
            userDog = findClosestDog(userDog);

            return View(userDog);
        }
Beispiel #15
0
        public override object Clone()
        {
            Bar bar = new Bar();

            if (Type != null)
            {
                bar.Type = Type.Clone();
            }
            if (Color != null)
            {
                bar.Color = Color.Clone();
            }
            if (EType != null)
            {
                bar.EType = EType.Clone();
            }
            if (EColor != null)
            {
                bar.EColor = EColor.Clone();
            }
            if (ESize != null)
            {
                bar.ESize = ESize.Clone();
            }
            if (GroupingBy != null)
            {
                bar.GroupingBy = GroupingBy.Clone();
            }
            if (Base != null)
            {
                bar.Base = Base.Clone();
            }
            bar.Visible = this.Visible;
            bar.AssignAttributeByVariables = this.AssignAttributeByVariables;
            foreach (DataViewPosition pos in DataViewPositionLst)
            {
                bar.DataViewPositionLst.Add((DataViewPosition)pos.Clone());
            }
            //bar.GetCommand = this.GetCommand;
            return(bar);
        }
 public ActionResult Index(bool goodWithChildren, bool drools, ELength coatlength, 
     EScale activityLevel, EScale sheddingLevel,  EScale groomingLevel,
     EScale intelligenceLevel, ESize size)
 {
     Dog requestedDog = new Dog
     {
         GoodWithChildren = goodWithChildren,
         Drools = drools,
         Coatlength = coatlength,
         ActivityLevel = activityLevel,
         SheddingLevel = sheddingLevel,
         GroomingLevel = groomingLevel,
         IntelligenceLevel = intelligenceLevel,
         Size = size
     };
     Dog returnDog = findDogRecommendation(requestedDog);
     if (returnDog.BreedName != null)
         return View("DogRecommendation", returnDog);
     else
         return View("NoDogRecommendation");
 }
        public ActionResult SelectedDog(EScale activityLevel, EScale sheddingLevel, EScale groomingLevel, EScale intelligenceLevel, ELength coatlength, ESize size, bool goodWithChildren, bool drools)
        {
            DatabaseManager dbm = new DatabaseManager();
            db = dbm.makeDatabase();

            Dog nDog = new Dog();
            nDog.ActivityLevel = activityLevel;
            nDog.SheddingLevel = sheddingLevel;
            nDog.GroomingLevel = groomingLevel;
            nDog.IntelligenceLevel = intelligenceLevel;
            nDog.Coatlength = coatlength;
            nDog.Size = size;
            nDog.GoodWithChildren = goodWithChildren;
            nDog.Drools = drools;

            nDog.BreedName = db[0].BreedName;
            nDog.ImageName = db[0].ImageName;
            nDog.DisplayName = db[0].DisplayName;

            Dog recommendation = dbm.FindRecommodation(db, nDog);

            return View(recommendation);
        }
Beispiel #18
0
 public void SetSize(ESize size)
 {
     Text2D.CharacterSize = GetSizeFromESize(size);
 }
Beispiel #19
0
        public Boolean AddView(IMoveable go, ESize size, out Vector3 localPosition, Int32 p_comeFrom, EntityPositioning p_oldPositioning)
        {
            localPosition = Vector3.zero;
            if (go == null)
            {
                return(false);
            }
            if (m_GameObjects == null)
            {
                m_GameObjects = new Entity[m_Template.Length];
            }
            if (p_comeFrom != -1)
            {
                CalculateRotation();
                Boolean flag = AddViewWithPreviousSlot(go, size, out localPosition, p_comeFrom, p_oldPositioning);
                if (flag)
                {
                    return(true);
                }
            }
            else if (go is LevelEntityView)
            {
                LevelEntityView levelEntityView = (LevelEntityView)go;
                EDirection      direction       = levelEntityView.MyController.Direction;
                SetDirection(direction);
            }
            Int32 num = -1;

            for (Int32 i = 0; i < m_GameObjects.Length; i++)
            {
                if (size != ESize.MEDIUM || i != 1)
                {
                    if (size != ESize.BIG || i == 1)
                    {
                        if (num == -1 && m_GameObjects[i].View == null)
                        {
                            num = i;
                        }
                        if (m_GameObjects[i].View == go)
                        {
                            num = i;
                            break;
                        }
                    }
                }
            }
            if (num > -1)
            {
                if (m_count == 0)
                {
                    num = 1;
                }
                Single num2 = (Single)m_direction * 90f;
                if (m_diagonal)
                {
                    num2 -= 45f;
                }
                localPosition = SetViewIntoSlot(go, num, num);
                return(true);
            }
            localPosition = Vector3.zero;
            return(false);
        }
Beispiel #20
0
	public static List<GameObject> FindModulesBySize(ESize _eModuleSize)
	{
		if (!s_mModulesBySize.ContainsKey(_eModuleSize))
		{
			return (null);
		}
		
		return (s_mModulesBySize[_eModuleSize]);
	}
        public ActionResult Result(EScale activityLevel, ELength coatlength, bool drools, bool goodWithChildren, EScale groomingLevel, EScale intelligenceLevel, EScale sheddingLevel, ESize size)
        {
            List <Dog> dogs = makeDatabase(); //gets dogs databse

            //creates dog with properties submitted in by user in html form
            Dog userDog = new Dog();

            userDog.ActivityLevel     = activityLevel;
            userDog.Coatlength        = coatlength;
            userDog.Drools            = drools;
            userDog.GoodWithChildren  = goodWithChildren;
            userDog.GroomingLevel     = groomingLevel;
            userDog.IntelligenceLevel = intelligenceLevel;
            userDog.SheddingLevel     = sheddingLevel;
            userDog.Size = size;

            //userDog is set to its best match
            userDog = findClosestDog(userDog);

            return(View(userDog));
        }
Beispiel #22
0
        public ActionResult ShowSelect(bool GoodWithChildren, bool Drooling, ELength CoatLength, EScale ActivityLevel,
                                       EScale SheddingLevel, EScale GroomingLevel, EScale IntelligenceLevel, ESize Size)
        {
            //makes the wanted dog
            Dog wantedDog = new Dog
            {
                ActivityLevel     = ActivityLevel,
                SheddingLevel     = SheddingLevel,
                GroomingLevel     = GroomingLevel,
                IntelligenceLevel = IntelligenceLevel,
                GoodWithChildren  = GoodWithChildren,
                Drools            = Drooling,
                CoatLength        = CoatLength,
                Size = Size
            };

            //calls method to find closest dog
            Dog closestMatch = findClosestMatch(wantedDog);

            //returns the view and dog
            return(View("DogRecomendation", closestMatch));
        }
        public ActionResult ShowSelect(bool GoodWithChildren, bool Drooling, ELength CoatLength, EScale ActivityLevel, 
            EScale SheddingLevel, EScale GroomingLevel, EScale IntelligenceLevel, ESize Size)
        {
            //makes the wanted dog
            Dog wantedDog = new Dog
            {
                ActivityLevel = ActivityLevel,
                SheddingLevel = SheddingLevel,
                GroomingLevel = GroomingLevel,
                IntelligenceLevel = IntelligenceLevel,
                GoodWithChildren = GoodWithChildren,
                Drools = Drooling,
                CoatLength = CoatLength,
                Size = Size
            };

            //calls method to find closest dog
            Dog closestMatch = findClosestMatch(wantedDog);

            //returns the view and dog
            return View("DogRecomendation", closestMatch);
        }
        //if values are the same assign 1
        //if it is not the same and it is 1 off either way
        // 0.5 is assigned because it is close
        public double getESizeValue(ESize wantedDogInput, ESize listDogInput)
        {
            double value = 0;

            if (wantedDogInput == listDogInput)
            {
                value = 1;
            }
            if (wantedDogInput == (listDogInput - 1) || wantedDogInput == (listDogInput + 1))
            {
                value = 0.5;
            }

            return value;
        }
Beispiel #25
0
 public Label(String text = null, ESize size = DEFAULT_TEXT_SIZE)
     : base()
 {
     Text2D = new Text(text == null ? "" : text, GameData.DEFAULT_FONT, GetSizeFromESize(size));
     Text2D.Color = DEFAULT_COLOR;
 }
Beispiel #26
0
 public Label(String text, Color color, ESize size = DEFAULT_TEXT_SIZE)
     : this(text, size)
 {
     Color = color;
 }
Beispiel #27
0
 public static UInt32 GetSizeFromESize(ESize size)
 {
     switch (size)
     {
         case ESize.VSmall: return VSMALL_TEXT_SIZE;
         case ESize.Small: return SMALL_TEXT_SIZE;
         case ESize.Medium: return MEDIUM_TEXT_SIZE;
         case ESize.Large: return LARGE_TEXT_SIZE;
         case ESize.VLarge: return VLARGE_TEXT_SIZE;
         case ESize.GameMenuVSmall: return GAMEMENU_VSMALL_TEXT_SIZE;
         case ESize.GameMenuSmall: return GAMEMENU_SMALL_TEXT_SIZE;
         case ESize.GameMenuMedium: return GAMEMENU_MEDIUM_TEXT_SIZE;
         case ESize.GameMenuLarge: return GAMEMENU_LARGE_TEXT_SIZE;
         case ESize.GameMenuVLarge: return GAMEMENU_VLARGE_TEXT_SIZE;
         case ESize.SpeechBubbleSmall: return SPEECHBUBBLE_SMALL_TEXT_SIZE;
         case ESize.SpeechBubbleMedium: return SPEECHBUBBLE_MEDIUM_TEXT_SIZE;
         case ESize.SpeechBubbleLarge: return SPEECHBUBBLE_LARGE_TEXT_SIZE;
         default: return MEDIUM_TEXT_SIZE;
     }
 }