Exemplo n.º 1
0
    public void SelectProfile(GizLib.Profile profile)
    {
        LocalDatabase.Instance.activeProfile = profile;
        LocalDatabase.Instance.SetLastProfileIndex(profile);

        onProfileChanged.Invoke(profile);
        gameObject.SetActive(false);
    }
Exemplo n.º 2
0
    public void PopulateUnitGrid()
    {
        profile = LocalDatabase.Instance.activeProfile;
        if (profile != null)
        {
            var data = gizmoidRoster.unitDatas.FindAll(x => profile.gizmoids.Contains((x as GizmoidData).typeId)).Cast <GizmoidData>().OrderBy(x => x.order).ToList();
            foreach (var item in data)
            {
                BuildLoadoutUnit(item);
            }
            TextSelectCount.text = selectedData.Count + "/" + profile.gizmoidSlots;

            var randData = data[Random.Range(0, data.Count)];
            previewPanel.SetPanel(randData.unitGraphics, randData.nameFull, randData.description);
        }
    }
Exemplo n.º 3
0
    public void BuildProfileButton(GizLib.Profile profile)
    {
        var pro = Instantiate(profileButtonPrefab);

        pro.transform.SetParent(profileListContainer);
        pro.transform.localScale = Vector3.one;
        pro.gameObject.name      = profile.name;
        pro.profile = profile;
        if (pro.text)
        {
            pro.text.text = profile.name;
        }

        pro.buttonSelect.onClick.AddListener(() => SelectProfile(profile));

        pro.buttonRemove.onClick.AddListener(() => RemoveProfile(profile, pro.gameObject));
    }
Exemplo n.º 4
0
 public void OnProfileChanged(GizLib.Profile profile)
 {
     HandleActiveProfile();
 }
Exemplo n.º 5
0
    public void PopulateMap(GizLib.Profile profile)
    {
        float anchor = 0.2f;
        bool  up     = true;

        float scrollX = 0;

        var platformPicks = new List <LevelPlatformButton>(platformButtons);

        for (int i = 0; i < levelSet.dataSet.Count; i++)
        {
            if (platformPicks.Count == 0)
            {
                platformPicks = new List <LevelPlatformButton>(platformButtons);
            }

            var           beaconColor = locked;
            var           clip        = clipLock;
            var           index       = i;
            System.Action action      = () => alertPrompt.ShowMessage("Mission " + levelSet.dataSet[index].localId + ": Locked", "Sorry, Mission " + levelSet.dataSet[index].localId + " is currently locked. Come back later.");

            bool canInteract = false;

            if (profile.completedLevels.Exists(x => x.localId == levelSet.dataSet[i].localId && x.worldId == levelSet.dataSet[i].worldId))
            {
                canInteract = true;
                beaconColor = completed;
            }
            else if (i == 0 || (i - 1 > 0 && profile.completedLevels.Exists(x => x.localId == levelSet.dataSet[i - 1].localId && x.worldId == levelSet.dataSet[i - 1].worldId)))
            {
                canInteract = true;

                beaconColor = current;
                scrollX     = ((i * 1f) + 1f) / (levelSet.dataSet.Count * 1f);
                if (scrollX > 0.25f)
                {
                    if (scrollX > 1f)
                    {
                        scrollX = 1f;
                    }
                }
                else
                {
                    scrollX = 0;
                }
            }

            if (canInteract)
            {
                action = () => alertPrompt.ShowMessage("Launch Mission " + levelSet.dataSet[index].localId, levelSet.dataSet[index].description, () => GoToGameplay(levelSet.dataSet[index]));
                clip   = clipClick;
            }

            var randIndex = Random.Range(0, platformPicks.Count);
            var button    = BuildPlatform(platformPicks[randIndex], anchor, beaconColor, clip, action);

            platformPicks.RemoveAt(randIndex);
            if (anchor > 0.7f || anchor < 0.2f)
            {
                up = !up;
            }
            if (up)
            {
                anchor += 0.3f;
            }
            else
            {
                anchor -= 0.3f;
            }
        }
        scrollRect.horizontalNormalizedPosition = scrollX;
    }
Exemplo n.º 6
0
 public void RemoveProfile(GizLib.Profile profile, GameObject gameObject)
 {
     LocalDatabase.Instance.DeleteProfile(profile);
     onProfileChanged.Invoke(profile);
     Destroy(gameObject);
 }