Пример #1
0
        /// <summary>
        ///     Clone an existing slide (make a copy)
        /// </summary>
        /// <param name="presentation">PPT.Presentation object instance</param>
        /// <param name="slide">PPT.Slide instance that is to be cloned</param>
        /// <param name="destination">Destination for the cloned slide</param>
        /// <param name="locationIndex">Optional index for the new slide (slide.Index)</param>
        /// <returns></returns>
        public PPT.SlideRange CloneSlide(
            PPT.Presentation presentation,
            PPT.Slide slide,
            Locations.Location destination,
            int locationIndex = 0)
        {
            PPT.SlideRange dupeSlide = slide.Duplicate();

            switch (destination)
            {
            case Locations.Location.First:
                dupeSlide.MoveTo(1);
                break;

            case Locations.Location.Last:
                dupeSlide.MoveTo((presentation.Slides.Count));
                break;

            case Locations.Location.Custom:
                dupeSlide.MoveTo(locationIndex);
                break;
            }

            return(dupeSlide);
        }
Пример #2
0
        /// <summary>
        ///     Moves a slide, changing its position with the presentation
        /// </summary>
        /// <param name="presentation">PPT.Presentation object instance</param>
        /// <param name="slide">PPT.Slide to move</param>
        /// <param name="destination">Destination location for the slide</param>
        /// <param name="locationIndex">Optional Index for the slides destination</param>
        /// <returns></returns>
        public PPT.Slide MoveSlide(
            PPT.Presentation presentation,
            PPT.Slide slide,
            Locations.Location destination,
            int locationIndex = 0)
        {
            switch (destination)
            {
            case Locations.Location.First:
                slide.MoveTo(1);
                break;

            case Locations.Location.Last:
                slide.MoveTo((presentation.Slides.Count));
                break;

            case Locations.Location.Custom:
                slide.MoveTo(locationIndex);
                break;
            }

            return(slide);
        }
Пример #3
0
 private void btnSideNavLocations_Click(object sender, EventArgs e)
 {
     this.Hide();
     Locations.Location loc = new Locations.Location();
     loc.ShowDialog();
 }
    // Use this for initialization
    void Start()
    {
        Shop         = Resources.Load <GameObject>("Standings/shop");
        CurrentRound = Round.QuarterFinal;

        if (PlayerPrefs.HasKey("CurrentRound"))
        {
            Debug.Log(JsonUtility.FromJson <Round> (PlayerPrefs.GetString("CurrentRound")));
            CurrentRound = JsonUtility.FromJson <Round>(PlayerPrefs.GetString("CurrentRound"));
        }
        else
        {
            CurrentRound = Round.QuarterFinal;
        }
        Transform canvas = GameObject.Find("Canvas").transform.root;

        // if we lose a game, we don't progress, but don't regress, so just set all top labels to our username
        GameObject.Find("Username").GetComponent <Text>().text  = PlayerPrefs.GetString("TeamName");
        GameObject.Find("Winner1").GetComponent <Text>().text   = PlayerPrefs.GetString("TeamName");
        GameObject.Find("Finalist1").GetComponent <Text>().text = PlayerPrefs.GetString("TeamName");
        GameObject.Find("Champion").GetComponent <Text>().text  = PlayerPrefs.GetString("TeamName");

        //hide user upper bracket labels
        canvas.Find("Winner1").gameObject.SetActive(false);
        canvas.Find("Finalist1").gameObject.SetActive(false);

        /* Location services enabled */
        if (Input.location.status == LocationServiceStatus.Running)
        {
            float latitude  = Input.location.lastData.latitude;
            float longitude = Input.location.lastData.longitude;
            //float latitude = 49.798654f;
            //float longitude = -119.512252f;

            /* Open cities database */

            QuarterFinalTeams = new string[7];

            Locations.Location[] cities = new Locations.Location[8];

            double max = distance(latitude, longitude, Locations.data[0].Latitude, Locations.data[0].Longitude);
            for (int i = 0; i < Locations.data.Length; i++)
            {
                Locations.Location location = Locations.data[i];
                double             dist     = distance(latitude, longitude, location.Latitude, location.Longitude);
                location.Distance = dist;
                if (i < 8)
                {
                    cities[i] = location;
                    max       = Math.Max(dist, max);
                }
                else
                {
                    if (dist < max)
                    {
                        cities[7] = location;
                        Array.Sort(cities, new Comparison <Locations.Location>((obj1, obj2) => obj1.Distance.CompareTo((Double)obj2.Distance)));
                    }
                }
            }

            //add animal names to end of city names
            for (int i = 0; i < 7; i++)
            {
                QuarterFinalTeams[i] = (cities[i].City + " " + animals[char.ToUpper(cities[i].City[0]) - 65]);
                GameObject.Find("Team" + (i + 1)).GetComponent <Text>().text = QuarterFinalTeams[i];
            }
        }

        QuarterFinalLabels = new GameObject[]
        {
            canvas.Find("Team1").gameObject,
            canvas.Find("Team2").gameObject,
            canvas.Find("Team3").gameObject,
            canvas.Find("Team4").gameObject,
            canvas.Find("Team5").gameObject,
            canvas.Find("Team6").gameObject,
            canvas.Find("Team7").gameObject,
        };

        SemiFinalLabels = new GameObject[]
        {
            canvas.Find("Winner2").gameObject,
            canvas.Find("Winner3").gameObject,
            canvas.Find("Winner4").gameObject,
        };
        FinalistLabels = new GameObject[]
        {
            canvas.Find("Finalist2").gameObject,
        };
        switch (CurrentRound)
        {
        case Round.QuarterFinal:
            SetLabelVisibility(SemiFinalLabels, false);
            SetLabelVisibility(FinalistLabels, false);
            SetLabelVisibility(new GameObject[] { canvas.Find("Champion").gameObject }, false);
            break;

        case Round.SemiFinal:

            //decide which teams that won the quarter finals if this is the first time visiting the standings page at the semi final level
            if (!PlayerPrefs.HasKey("QuarterFinalWinners"))
            {
                PlayerPrefs.SetString("QuarterFinalWinners", SerializeStringArray(DecideQuarterFinalWinners()));
            }


            canvas.Find("Winner1").gameObject.SetActive(true);
            SetLabelVisibility(SemiFinalLabels, true);
            SetLabelVisibility(FinalistLabels, false);
            SetLabelVisibility(new GameObject[] { canvas.Find("Champion").gameObject }, false);
            break;

        case Round.Finals:
            if (!PlayerPrefs.HasKey("SemiFinalWinner") || true)
            {
                PlayerPrefs.SetString("SemiFinalWinner", DecideSemiFinalWinner());
            }

            canvas.Find("Winner1").gameObject.SetActive(true);
            canvas.Find("Finalist1").gameObject.SetActive(true);
            SetLabelVisibility(SemiFinalLabels, true);
            SetLabelVisibility(FinalistLabels, true);
            SetLabelVisibility(new GameObject[] { canvas.Find("Champion").gameObject }, false);
            break;

        case Round.Finished:
            canvas.Find("Winner1").gameObject.SetActive(true);
            canvas.Find("Finalist1").gameObject.SetActive(true);
            SetLabelVisibility(SemiFinalLabels, true);
            SetLabelVisibility(FinalistLabels, true);
            SetLabelVisibility(new GameObject[] { canvas.Find("Champion").gameObject }, true);
            DiscolorLabel(canvas.transform.Find("Finalist2").gameObject);

            GameObject.Find("Continue").SetActive(false);
            break;
        }
        if (CurrentRound != Round.Finished)
        {
            GameObject.Find("ButtonChampion").SetActive(false);
        }

        if (PlayerPrefs.HasKey("QuarterFinalWinners"))
        {
            string[] quarterFinalWinners = DeserializeStringArray(PlayerPrefs.GetString("QuarterFinalWinners"));
            for (int i = 0; i < SemiFinalLabels.Length; i++)
            {
                GameObject label = SemiFinalLabels[i];
                label.GetComponent <Text>().text = quarterFinalWinners[i];
            }
            DiscolourNonWinners(QuarterFinalLabels, quarterFinalWinners);
        }
        if (PlayerPrefs.HasKey("SemiFinalWinner"))
        {
            string semiFinalWinner = PlayerPrefs.GetString("SemiFinalWinner");
            canvas.transform.Find("Finalist2").GetComponent <Text>().text = semiFinalWinner;
            DiscolourNonWinners(SemiFinalLabels, new string[] { semiFinalWinner });
        }
    }
Пример #5
0
    void Start()
    {
        ic = CandidateContainer.Load(path);

        while (true)
        {
            randCandidateA = findValidCandidate("A");
            if (randCandidateA != -1)
            {
                availableCandidates[randCandidateA] = -1;
                randAMoral = ic.candidates[randCandidateA].moral;
                break;
            }
        }
        while (true)
        {
            randCandidateB = findValidCandidate("B");
            if (randCandidateB != -1)
            {
                availableCandidates[randCandidateB] = -1;
                break;
            }
        }

        GameObject player = GameObject.Find("Player");

        CandidateAssociations cAssociations = FindObjectOfType <CandidateAssociations>();

        Vector3[] townSpawn = { new Vector3(-105.9f, -220.2f, 0), new Vector3(-109, -194.4f, 0), new Vector3(-102.8f, -162.2f, 0), new Vector3(-90, -194, 0), new Vector3(-77.2f, -210, 0), new Vector3(-70.6f, -191, 0), new Vector3(-61.5f, -200.5f, 0), new Vector3(-48.2f, -162, 0), new Vector3(-32, -213, 0), new Vector3(-23, -181.2f, 0), new Vector3(-19.7f, -162.4f, 0) };
        cAssociations.locations.Add(new Locations.Location(new Vector3(-48, -220, 0), "Town Square", townSpawn));

        foreach (CandidateXML candidate in ic.candidates)
        {
            if (candidate.id.Equals(randCandidateA.ToString()))
            {
                candidateA = transform.Find("First Candidate Profile");

                try {
                    candidateAController           = candidateA.GetComponent <CandidateAController>();
                    candidateAController.sprite    = sprites[randCandidateA];
                    candidateAController.fullname  = candidate.fullname;
                    cAssociations.CandidateAName   = candidate.fullname.Split(' ')[0];
                    candidateAController.moral     = candidate.moral;
                    candidateAController.goodArray = candidate.goodArray;
                    candidateAController.badArray  = candidate.badArray;
                    candidateAController.houseSize = candidate.houseSize;
                    Locations locations = player.GetComponent <Locations>();
                    for (int i = 0; i < locations.locations.Count; i++)
                    {
                        Locations.Location loco = (Locations.Location)locations.locations[i];
                        if (candidateAController.houseSize.Equals(loco.size))
                        {
                            cAssociations.houseA = loco;
                            cAssociations.locations.Add(loco);
                            locations.locations.RemoveAt(i);
                            break;
                        }
                    }
                    cAssociations.npcNameA = candidate.npcName;
                    cAssociations.itemNamesA.Add(candidate.itemName1);
                    cAssociations.itemNamesA.Add(candidate.itemName2);
                    candidateAController.birthdate   = candidate.birthdate;
                    candidateAController.ethnicity   = candidate.ethnicity;
                    candidateAController.occupation  = candidate.occupation;
                    candidateAController.skills      = candidate.skills;
                    candidateAController.description = candidate.description;
                    candidateAController.traits      = candidate.traits;
                } catch (NullReferenceException) {
                    print("stupid exception");
                }
            }
            else if (candidate.id.Equals(randCandidateB.ToString()))
            {
                candidateB = transform.Find("Second Candidate Profile");

                try {
                    candidateBController           = candidateB.GetComponent <CandidateBController>();
                    candidateBController.sprite    = sprites[randCandidateB];
                    candidateBController.fullname  = candidate.fullname;
                    cAssociations.CandidateBName   = candidate.fullname.Split(' ')[0];
                    candidateBController.moral     = candidate.moral;
                    candidateBController.goodArray = candidate.goodArray;
                    candidateBController.badArray  = candidate.badArray;
                    candidateBController.houseSize = candidate.houseSize;
                    Locations locations = player.GetComponent <Locations>();
                    for (int i = 0; i < locations.locations.Count; i++)
                    {
                        Locations.Location loco = (Locations.Location)locations.locations[i];
                        if (candidateBController.houseSize.Equals(loco.size))
                        {
                            cAssociations.houseB = loco;
                            cAssociations.locations.Add(loco);
                            locations.locations.RemoveAt(i);
                            break;
                        }
                    }
                    cAssociations.npcNameB = candidate.npcName;
                    cAssociations.itemNamesB.Add(candidate.itemName1);
                    cAssociations.itemNamesB.Add(candidate.itemName2);
                    candidateBController.birthdate   = candidate.birthdate;
                    candidateBController.ethnicity   = candidate.ethnicity;
                    candidateBController.occupation  = candidate.occupation;
                    candidateBController.skills      = candidate.skills;
                    candidateBController.description = candidate.description;
                    candidateBController.traits      = candidate.traits;
                } catch (NullReferenceException) {
                    print("stupid exception");
                }
            }
        }

        FindObjectOfType <ObjectSpawning>().spawnItems();
    }
Пример #6
0
    // Use this for initialization
    public void spawnItems()
    {
        associations = FindObjectOfType <CandidateAssociations>();
        townSquare   = (Locations.Location)associations.locations[1];
        for (int i = 0; i < npcIsUsed.Length; i++)
        {
            npcIsUsed[i] = false;
        }

        // generating objects for candidate A
        itemsA     = associations.itemNamesA;
        candidateA = associations.CandidateAName;
        houseA     = associations.houseA;
        foreach (Vector3 location in houseA.itemSpawnLocations)
        {
            isPlacedA.Add(false);
        }
        npcNameA = candidateA + "_NPC";

        // generating objects for candidate B
        itemsB     = associations.itemNamesB;
        candidateB = associations.CandidateBName;
        houseB     = associations.houseB;
        foreach (Vector3 location in houseB.itemSpawnLocations)
        {
            isPlacedB.Add(false);
        }
        npcNameB = candidateB + "_NPC";

        foreach (Vector3 location in townSquare.itemSpawnLocations)
        {
            isPlacedInTown.Add(false);
        }

        System.Random rnd = new System.Random();

        // randomly placing clue items for candidate A
        for (int i = 0; i < itemsA.Count; i++)
        {
            bool   hasPlaced = false;
            string itemName  = candidateA + "_" + itemsA [i];
            Debug.Log("Going to instantiate: " + itemName);
            GameObject currentObject = GameObject.Find(itemName);

            while (!hasPlaced)
            {
                int place = rnd.Next(houseA.itemSpawnLocations.Length);
                if (!isPlacedA[place])
                {
                    currentObject.transform.position = houseA.itemSpawnLocations[place];
                    isPlacedA[place] = true;
                    hasPlaced        = true;
                }
            }
        }

        // randomly placing clue items for candidate B
        for (int i = 0; i < itemsB.Count; i++)
        {
            bool   hasPlaced = false;
            string itemName  = candidateB + "_" + itemsB [i];
            Debug.Log("Going to instantiate: " + itemName);
            GameObject currentObject = GameObject.Find(itemName);

            while (!hasPlaced)
            {
                int place = rnd.Next(houseB.itemSpawnLocations.Length);
                if (!isPlacedB[place])
                {
                    currentObject.transform.position = houseB.itemSpawnLocations[place];
                    isPlacedB[place] = true;
                    hasPlaced        = true;
                }
            }
        }

        // spawning NPC for candidate A
        GameObject currentNPC = Instantiate(Resources.Load("NPC/" + npcNameA)) as GameObject;

        while (!placedNPC)
        {
            npcSpawnPoint = rnd.Next(townSquare.itemSpawnLocations.Length);
            if (!isPlacedInTown[npcSpawnPoint])
            {
                currentNPC.transform.position = townSquare.itemSpawnLocations[npcSpawnPoint];
                isPlacedInTown[npcSpawnPoint] = true;
                placedNPC = true;
            }
        }

        // spawning NPC for candidate B
        currentNPC = Instantiate(Resources.Load("NPC/" + npcNameB)) as GameObject;
        placedNPC  = false;

        while (!placedNPC)
        {
            npcSpawnPoint = rnd.Next(townSquare.itemSpawnLocations.Length);
            if (!isPlacedInTown[npcSpawnPoint])
            {
                currentNPC.transform.position = townSquare.itemSpawnLocations[npcSpawnPoint];
                isPlacedInTown[npcSpawnPoint] = true;
                placedNPC = true;
            }
        }

        // spawning non-interactable NPCs
        for (int i = 0; i < 4; i++)
        {
            placedNPC = false;
            npcToUse  = Random.Range(1, 17);

            while (npcIsUsed[npcToUse - 1])
            {
                npcToUse = Random.Range(1, 17);
            }

            Debug.Log("Trying to instantiate npc" + npcToUse);
            currentNPC = Instantiate(Resources.Load("NPC/npc" + npcToUse)) as GameObject;

            while (!placedNPC)
            {
                npcSpawnPoint = rnd.Next(townSquare.itemSpawnLocations.Length);
                if (!isPlacedInTown[npcSpawnPoint])
                {
                    currentNPC.transform.position = townSquare.itemSpawnLocations[npcSpawnPoint];
                    isPlacedInTown[npcSpawnPoint] = true;
                    placedNPC = true;
                    npcIsUsed[npcToUse - 1] = true;
                }
            }
        }
    }
Пример #7
0
    void OpenTheGui()
    {
        player.DisableMovement();
        interactor.interacting = true;
        if (!isGenerated)
        {
            //Create the menu from stored locations
            CandidateAssociations cAssociations = FindObjectOfType <CandidateAssociations>();
            for (int i = 0; i < cAssociations.locations.Count; i++)
            {
                Locations.Location loco = (Locations.Location)cAssociations.locations[0];
                // To instantiate
                GameObject newButton = (GameObject)Instantiate(buttonPrefab);
                newButton.transform.SetParent(Content.transform, false);
                newButton.transform.localScale = new Vector3(1, 1, 1);
                if (i == 0)
                {
                    if (isNotRegen)
                    {
                        newButton.name = "Office";
                        newButton.GetComponentInChildren <Text>().text = "Office";
                        isNotRegen = false;
                    }
                    else
                    {
                        GameObject.Destroy(newButton);
                    }
                }

                else if (i == 1)
                {
                    newButton.name = "Town Square";
                    newButton.GetComponentInChildren <Text>().text = "Town Square";
                    loco = (Locations.Location)cAssociations.locations[1];
                }

                else if (i == 2)
                {
                    newButton.name = cAssociations.CandidateAName;
                    newButton.GetComponentInChildren <Text>().text = cAssociations.CandidateAName + "'s House";
                    loco = cAssociations.houseA;
                }
                else
                {
                    newButton.name = cAssociations.CandidateBName;
                    newButton.GetComponentInChildren <Text>().text = cAssociations.CandidateBName + "'s House";
                    loco = cAssociations.houseB;
                }
                Button thisButton = newButton.GetComponent <Button>();

                Vector3 capturedLocation = loco.entrance;
                thisButton.onClick.AddListener(() => {
                    StartCoroutine(WarpTo(capturedLocation, thisButton.GetComponentInChildren <Text>().text));
                    WarpUI.SetActive(false);
                    player.EnableMovement();
                    interactor.interacting = false;
                });
            }
            other.GetComponent <Locations>().isGenerated = true;
        }

        // Open up the GUI
        WarpUI.SetActive(true);
    }