void Awake()
 {
     instance           = this;
     Screen.orientation = ScreenOrientation.Portrait;
     // Debug.Log("SCREEN " +Screen.orientation);
     // Screen.autorotateToPortrait = true;
 }
Beispiel #2
0
    void Update()
    {
        ScrollSnapRect ssr = options.GetComponent <ScrollSnapRect>();

        // how many objects are in the folder
        howmuch.text = (ssr._currentPage + 1) + " / " + ssr._pageCount;
    }
    public void AddLevels(List <LevelsContainer> levelsContainer, List <SaveData> saves)
    {
        for (int i = saves.Count - 1, j = 0; i >= 0; i--)
        {
            LevelsContainer  container = null;
            LevelDescription lvl       = null;
            foreach (var lc in levelsContainer)
            {
                lvl = lc.Levels.Find(x => x.ID == saves[i].LevelID);
                if (lvl != null)
                {
                    container = lc;
                    break;
                }
            }
            if (lvl != null)
            {
                if ((j) % (LevelsOnPage) == 0)
                {
                    RectTransform lvlPage = Instantiate(PagePrefab);
                    pages.Add(lvlPage);

                    lvlPage.transform.SetParent(PageParent);
                    lvlPage.transform.localScale = Vector3.one;
                    lvlPage.offsetMin            = Vector2.zero;
                    lvlPage.offsetMax            = Vector2.zero;
                    // CalculateInventoryPanelParameters(lvlPage, LevelsOnPage);
                }
                Button btn = Instantiate(LevelButtonPrefab);
                btn.transform.SetParent(pages[pages.Count - 1]);
                btn.transform.localScale = Vector3.one;
                btn.GetComponentInChildren <TextMeshProUGUI>().text = lvl.Name;


                RecordLevelSave recordLevelSave = FindObjectOfType <RecordLevelSave>();
                if (recordLevelSave != null)
                {
                    int record = recordLevelSave.GetRecordByLevelID(lvl);
                    if (record != 0)
                    {
                        SetPassedLevel(btn.transform, record.ToString());
                    }
                }
                btn.onClick.AddListener(() =>
                {
                    GameManager.Instance.LoadLevel(lvl, container);
                });
                j++;
            }
        }
        ScrollSnapRect scrollSnapRect = GetComponentInChildren <ScrollSnapRect>();

        if (scrollSnapRect != null)
        {
            scrollSnapRect.OnPageSwitched += GetCurrentPage;
        }
        GetCurrentPage(currentPage);
    }
Beispiel #4
0
    void Start()
    {
        scroll      = scrollObject.GetComponent <ScrollSnapRect>();
        playerStats = GetComponent <playerStats>();

        if (PlayerPrefs.GetInt("carrosComprados").ToString() == "")
        {
            PlayerPrefs.SetInt("carrosComprados", 0);
        }
    }
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        bool wasTouched = (Input.touchCount > 0 || Input.GetMouseButtonDown(0));

        scrollSnapRect = this.transform.parent.GetComponentInParent <ScrollSnapRect> ();
        scrollSnapRect.LerpToPage(4);


        if (wasTouched)
        {
        }
    }
Beispiel #6
0
    void Awake()
    {
        ssr = options.GetComponent <ScrollSnapRect>();

        XDocument   classdoc = XDocument.Parse(classes.text);
        List <Node> units    = LoadUnits(classdoc.Descendants("Units").Elements("Unit"));
        //DebugTree(units);
        //check = units;

        SubjectScript ss = layers[0].GetComponent <SubjectScript>();

        ss.Check(units[0]);
    }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     socketController = GameObject.Find("SocketReceiver");
     socket           = socketController.GetComponent <Client>();
     ScrollerContent  = GameObject.Find("ScrollerDrop");
     GetImageContent  = GameObject.Find("ImageContentGet");
     ImageContent     = GameObject.Find("ImageContent");
     Message          = GameObject.Find("Message").GetComponent <InputField>();
     ScrollRect       = ScrollerContent.GetComponent <ScrollSnapRect>();
     ScrollerContent.SetActive(true);
     GetImageContent.SetActive(false);
     isDropMode = true;
     LoadTexture();
 }
Beispiel #8
0
    //---------------------------------------------------------------
    void OnMouseUp()
    {
        ScrollSnapRect scrollSnapRect = GameObject.FindObjectOfType <ScrollSnapRect>();

        if (!scrollSnapRect)          //in case displayed in Input Section
        {
            return;
        }
        if (scrollSnapRect.GetDragStatus() == false)
        {
            MapSelectManager mapMng = GameObject.FindObjectOfType <MapSelectManager>();
            mapMng.DisplayGoButton();
            PlayerPrefManager.SetCurrentLevelName(mapName);
        }
    }
Beispiel #9
0
    public void textManager(string title, string body, string date)
    {
        this.title.text = title;
        this.body.text  = body;
        this.date.text  = date;

        ScrollSnapRect ssr = godPanel.GetComponentsInChildren <ScrollSnapRect>()[0];
        GameObject     go  = GameObject.Instantiate(textPanel, new Vector3(0, 0, 0), Quaternion.identity);

        go.transform.SetParent(godPanel.transform.GetChild(0).transform.GetChild(0).transform);

        go.transform.localScale = new Vector3(1, 1, 1);

        ssr._pageCount++;
        ssr.SetPagePositions();
    }
Beispiel #10
0
    public void ChangeToCharacterSelect()
    {
        mapSelectGameObj.SetActive(false);
        charSelectGameObj.SetActive(true);
        ScrollSnapRect scrollSnapRect = mapPanel.GetComponentInChildren <ScrollSnapRect>();

        if (scrollSnapRect)
        {
            selectedMap = scrollSnapRect.GetCurrentMapName();
            Debug.Log(selectedMap);
        }
        else
        {
            Debug.Log("not found scroll snap rect object to get map name");
        }
    }
Beispiel #11
0
    //---------------------------------------------------------------
    public void LoadMap()
    {
        ScrollSnapRect scrollSnapObj = GameObject.FindObjectOfType <ScrollSnapRect>();

        if (!scrollSnapObj)
        {
            Debug.LogError("No scrollSnapRect Object found");
            return;
        }
        if (scrollSnapObj.GetDragStatus() == false)        //if the page is not being dragged
        {
            int pageIndex;
            pageIndex = scrollSnapObj.GetCurrentPage();
            SceneManager.LoadScene("03 Level " + pageIndex.ToString());
        }
    }
Beispiel #12
0
    //------------------------------------------------------------------------
    void Start()
    {
        self = this;
        _scrollRectComponent = GetComponent <ScrollRect>();
        _scrollRectRect      = GetComponent <RectTransform>();
        _container           = _scrollRectComponent.content;
        _pageCount           = _container.childCount;

        // is it horizontal or vertical scrollrect
        if (_scrollRectComponent.horizontal && !_scrollRectComponent.vertical)
        {
            _horizontal = true;
        }
        else if (!_scrollRectComponent.horizontal && _scrollRectComponent.vertical)
        {
            _horizontal = false;
        }
        else
        {
            Debug.LogWarning("Confusing setting of horizontal/vertical direction. Default set to horizontal.");
            _horizontal = true;
        }

        _lerp = false;

        // init
        SetPagePositions();
        SetPage(startingPage);
        InitPageSelection();
        SetPageSelection(startingPage);

        // prev and next buttons
        if (nextButton)
        {
            nextButton.GetComponent <Button>().onClick.AddListener(() => { NextScreen(); });
        }

        if (prevButton)
        {
            prevButton.GetComponent <Button>().onClick.AddListener(() => { PreviousScreen(); });
        }

        if (transform.parent.name == "fon_too_much_photo")
        {
            SetPage(BottomBar.self.jj);
        }
    }
    public void AddLevels(LevelsContainer levelsContainer)
    {
        for (int i = 0; i < levelsContainer.Levels.Count; i++)
        {
            if (i == 0 || (i) % (LevelsOnPage) == 0)
            {
                RectTransform lvlPage = Instantiate(PagePrefab);

                pages.Add(lvlPage);
                lvlPage.transform.SetParent(PageParent);
                lvlPage.transform.localScale = Vector3.one;
                lvlPage.offsetMin            = Vector2.zero;
                lvlPage.offsetMax            = Vector2.zero;
                //CalculateInventoryPanelParameters(lvlPage, LevelsOnPage);
            }
            Button btn = Instantiate(LevelButtonPrefab);
            btn.transform.SetParent(pages[pages.Count - 1]);
            btn.transform.localScale = Vector3.one;
            btn.GetComponentInChildren <TextMeshProUGUI>().text = levelsContainer.Levels[i].Name;



            LevelDescription lvl             = levelsContainer.Levels[i];
            RecordLevelSave  recordLevelSave = FindObjectOfType <RecordLevelSave>();
            if (recordLevelSave != null)
            {
                int record = recordLevelSave.GetRecordByLevelID(lvl);
                if (record != 0)
                {
                    SetPassedLevel(btn.transform, record.ToString());
                }
            }
            btn.onClick.AddListener(() =>
            {
                GameManager.Instance.LoadLevel(lvl, levelsContainer);
            });
        }
        ScrollSnapRect scrollSnapRect = GetComponentInChildren <ScrollSnapRect>();

        if (scrollSnapRect != null)
        {
            scrollSnapRect.OnPageSwitched += GetCurrentPage;
        }
        GetCurrentPage(currentPage);
    }
Beispiel #14
0
    //------------------------------------------------------------------------
    private void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }

#if UNITY_IPHONE || UNITY_IOS
        float SizeScreen = (float)Screen.width / (float)Screen.height;
        float SizeCheck  = 3f / 4f;
        //  Debug.Log(System.Math.Round(SizeScreen, 4) + " " + System.Math.Round(SizeCheck, 4));
        if (System.Math.Round(SizeScreen, 2) == System.Math.Round(SizeCheck, 2))
        {
            //PanelChild[1].GetChild(0).GetComponent<RectTransform>().localPosition = new Vector2(PanelChild[1].GetChild(0).GetComponent<RectTransform>().localPosition.x, 100);
            for (int i = 0; i <= 8; i++)
            {
                PanelChild[i].GetComponent <RectTransform>().localScale = new Vector3(0.88f, 0.88f, 0.88f);
                //  PanelChild[i].GetComponent<RectTransform>().localPosition = new Vector2(PanelChild[i].GetChild(0).GetComponent<RectTransform>().localPosition.x, 18);
            }
        }
#endif
    }
Beispiel #15
0
    //---------------------------------------------------------------
    // Use this for initialization
    void Start()
    {
        mapScroller    = mapPanel.transform.GetChild(0);
        scrollSnapRect = mapScroller.GetComponent <ScrollSnapRect>();

        dotLocationNames = new string[MapDictionary.GetThisWorldLocations().Length];
        //initialise name of each dot location based on the database map dictionary
        if (transform.childCount != MapDictionary.GetThisWorldLocations().Length)
        {
            Debug.LogError("the number of location dots is not equal to number of maps stored in database." +
                           " Please make sure they are equal");
        }

        for (int i = 0; i < transform.childCount; i++)
        {
            dotLocationNames[i] = MapDictionary.GetThisWorldLocations()[i];
        }

        originRotation = transform.rotation;
        //ShowCorrespondIndicator();
        mapPanel.SetActive(false);
    }
Beispiel #16
0
    public void Check(Node unit)
    {
        string sub = unit.Name;

        //Debug.Log(sub);
        title.text = sub;
        title.name = sub;

        foreach (Transform child in container.transform)
        {
            GameObject.Destroy(child.gameObject);
        }

        for (int i = 0; i < unit.Children.Count; i++)
        {
            Node _option;
            _option = unit.Children[i];
            //Debug.Log(_option);

            GameObject   opt = (GameObject)Instantiate(option, transform.position, Quaternion.identity);
            OptionScript os  = opt.GetComponent <OptionScript>();
            os.node = _option;
            //Debug.Log(os.node.Name);

            opt.transform.SetParent(container.transform);
            opt.name = _option.Name;
            opt.GetComponentInChildren <Text>().text = _option.Name;
        }

        ScrollSnapRect ssr = options.GetComponent <ScrollSnapRect>();

        if (ssr._pageCount > 0)
        {
            ssr.LerpToPage(0);
            ssr.SetPagePositions();
        }
    }
Beispiel #17
0
 private void Start()
 {
     scrollRectSnap = GetComponentInParent <ScrollSnapRect>();
 }
    /// <summary>
    /// loads saved user data, if it exists
    /// </summary>
    /// <param name="topic">Chosen topic of the user</param>
    void LoadUserData(Topic topic)
    {
        Debug.Log(folderDataPath);
        if (File.Exists(folderDataPath))
        {
            string data = File.ReadAllText(folderDataPath);
            userData = JsonUtility.FromJson <UserData> (data);

            switch (topic)
            {
            case Topic.ADD:
                Debug.Log("Add");
                DisableAll();
                contents [0].gameObject.SetActive(true);
//				scrollContainers [0].gameObject.SetActive (true);
                scroll            = scrollContainers.gameObject.GetComponent <ScrollSnapRect> ();
                scroll._container = contents [0];
                scroll._scrollRectRect.gameObject.GetComponent <ScrollRect> ().content = contents [0];
                contents [0].localPosition      = origPosition;
                scroll._container.localPosition = origPosition;
                scroll.sceneNames = scroll.GetComponent <SceneNamesReader> ().GetAddSceneNames();
                scroll.SetPageCount(scroll.sceneNames.Length);
                scroll.SetPagePositions();
                scroll.SetCurrentScene(0);
                gameObject.GetComponentInChildren <LevelSelector> ().LoadUserData(topic, userData.currentAdditionSimilarFractionsLevel);
                break;

            case Topic.SUB:
                Debug.Log("Sub");
                DisableAll();
                contents [1].gameObject.SetActive(true);
//				scrollContainers [1].gameObject.SetActive (true);
                scroll            = scrollContainers.gameObject.GetComponent <ScrollSnapRect> ();
                scroll._container = contents [1];
                scroll._scrollRectRect.gameObject.GetComponent <ScrollRect> ().content = contents [1];
                contents[1].localPosition       = origPosition;
                scroll._container.localPosition = origPosition;
                scroll.sceneNames = scroll.GetComponent <SceneNamesReader> ().GetSubSceneNames();
                scroll.SetPageCount(scroll.sceneNames.Length);
                scroll.SetPagePositions();
                scroll.SetCurrentScene(0);
                gameObject.GetComponentInChildren <LevelSelector> ().LoadUserData(topic, userData.currentSubtractionSimilarFractionsLevel);
                break;

            case Topic.MIXED:
                Debug.Log("Mixed");
                DisableAll();
                contents [2].gameObject.SetActive(true);
//				scrollContainers.gameObject.SetActive (true);
                scroll            = scrollContainers.gameObject.GetComponent <ScrollSnapRect> ();
                scroll._container = contents [2];
                scroll._scrollRectRect.gameObject.GetComponent <ScrollRect> ().content = contents [2];
                contents[2].localPosition       = origPosition;
                scroll._container.localPosition = origPosition;
                scroll.sceneNames = scroll.GetComponent <SceneNamesReader> ().GetDisSceneNames();
                scroll.SetPageCount(scroll.sceneNames.Length);
                scroll.SetPagePositions();
                scroll.SetCurrentScene(0);
                gameObject.GetComponentInChildren <LevelSelector> ().LoadUserData(topic, userData.currentDissimilarFractionsLevel);
                break;
            }
            Debug.Log("[SELECT SCENE SCREEN]: Loaded user data");
        }
        else
        {
            Debug.Log("Unable to read the saved user data, file doesn't exist");
            userData = new UserData();
        }
    }
Beispiel #19
0
    // Use this for initialization
    void Start()
    {
        _scrollSnapRect = Swiper.GetComponent<ScrollSnapRect>();

        l_AngeloObjects = new List<GameObject>();
        l_JoeObjects = new List<GameObject>();
        l_ManuelObjects = new List<GameObject>();

        Load_objectlist();
    }
Beispiel #20
0
 private void Awake()
 {
     lsScreen = GetComponent <ScrollSnapRect>();
     lsScreen.startingPage = LevelSelector.instance.CurrentPage;
 }
Beispiel #21
0
    public void SwitchImage()
    {
        ScrollSnapRect ssr = classes.GetComponent <ScrollSnapRect>();

        ssr.LerpToPage(screenIndex);
    }