示例#1
0
    // Use this for initialization
    IEnumerator Start()
    {
        yield return(0);

        //Setting up the stars rating(Average)
        ShapesManager shapesManager  = GameObject.Find(shapesManagerReference).GetComponent <ShapesManager> ();
        int           collectedStars = DataManager.GetCollectedStars(shapesManager);
        int           starsRate      = Mathf.FloorToInt(collectedStars / (shapesManager.shapes.Count * 3.0f) * 3.0f);

        if (starsRate == 0)          //Zero Stars
        {
            stars [0].sprite = starOff;
            stars [1].sprite = starOff;
            stars [2].sprite = starOff;
        }
        else if (starsRate == 1)           //One Star
        {
            stars [0].sprite = starOn;
            stars [1].sprite = starOff;
            stars [2].sprite = starOff;
        }
        else if (starsRate == 2)            //Two Stars
        {
            stars [0].sprite = starOn;
            stars [1].sprite = starOn;
            stars [2].sprite = starOff;
        }
        else            //Three Stars
        {
            stars [0].sprite = starOn;
            stars [1].sprite = starOn;
            stars [2].sprite = starOn;
        }
    }
示例#2
0
    private bool gameOver; //Is the Game over?

    #endregion Fields

    #region Methods

    void setWinner(ShapesManager p)
    {
        PlayerPrefs.SetInt ("winner", p.player);
        PlayerPrefs.SetInt ("CharWin", p.getCharNum()-1);

        Application.LoadLevel ("Winner");
    }
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                var shapesManager = new ShapesManager();
                shapesManager.Clear();
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
示例#4
0
    void Awake()
    {
        if (!string.IsNullOrEmpty(ShapesManager.shapesManagerReference))
        {
            shapesManager = GameObject.Find(ShapesManager.shapesManagerReference).GetComponent <ShapesManager> ();
        }
        else
        {
            Debug.LogError("You have to start the game from the Main scene");
        }

        collectedStars = 0;

        //define the shapes list
        shapes = new List <TableShape> ();

        //Create new shapes
        StartCoroutine("CreateShapes");

        //Setup the last selected group index

        /*
         * ScrollSlider scrollSlider = GameObject.FindObjectOfType<ScrollSlider> ();
         * if (saveLastSelectedGroup && shapesManager != null) {
         *      scrollSlider.currentGroupIndex = shapesManager.lastSelectedGroup;
         * }*/
    }
示例#5
0
    void Awake()
    {
        //Initiate values and setup the references
        cursorDefaultSize = hand.transform.localScale;
        cursorClickSize   = cursorDefaultSize / 1.2f;

        if (!string.IsNullOrEmpty(ShapesManager.shapesManagerReference))
        {
            shapesManager = GameObject.Find(ShapesManager.shapesManagerReference).GetComponent <ShapesManager>();
        }
        else
        {
            Debug.LogErrorFormat("You have to start the game from the Main scene");
        }

        if (currentPencil != null)
        {
            currentPencil.EnableSelection();
        }

        shapePicture.sprite = shapesManager.shapes [TableShape.selectedShape.ID - 1].picture;
        if (shapePicture.sprite == null)
        {
            shapePicture.enabled = false;
        }
        ResetTargetQuarter();
        SetShapeOrderColor();
        CreateShape();
    }
示例#6
0
 protected override void Given()
 {
     this.powerpointHandle   = new Microsoft.Office.Interop.PowerPoint.Application();
     this.slideManager       = new SlideManager();
     this.presentationHandle = this.SUT.CreatePowerPointPresentation(this.powerpointHandle, false);
     this.slideHandle        = this.slideManager.AddSlideToEnd(this.presentationHandle);
     this.shapesHandler      = new ShapesManager();
 }
        public ActionResult LogOff()
        {
            var shapesManager = new ShapesManager();

            shapesManager.Clear();

            AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Remove(string id)
        {
            // TODO validate parameters
            var userName      = User.Identity.Name;
            var shapesManager = new ShapesManager();

            shapesManager.RemoveShape(id, userName);
            return(Json(new { result = "ok" }));
        }
示例#9
0
 public void Awake()
 {
     setHints();
     while (sm == null)
     {
         sm = GameObject.Find("ShapesManager").GetComponent <ShapesManager> ();
     }
     markers        = new List <GameObject>();
     minimumMatches = 3;
 }
 // Use this for initialization
 void Start()
 {
     levelText      = GetComponentInChildren <Text>();
     levelText.text = "Lv. " + (currentLevel).ToString("n0");
     scoreManager   = FindObjectOfType <ScoreManager>();
     shapesManager  = FindObjectOfType <ShapesManager>();
     soundManager   = FindObjectOfType <SoundManager>();
     gameManager    = FindObjectOfType <GameManager>();
     timer          = FindObjectOfType <Timer>();
 }
示例#11
0
 void Awake()
 {
     StoreManager.Init();
     UIManager.Init();
     shapesManager = this.gameObject.GetComponent <ShapesManager>();
     EventManager.StartListening(Constants.SWIPE_RIGHT_EVENT, SwipeRightEvent);
     EventManager.StartListening(Constants.SWIPE_LEFT_EVENT, SwipeLeftEvent);
     EventManager.StartListening(Constants.SWIPE_UP_EVENT, SwipeUpEvent);
     EventManager.StartListening(Constants.SWIPE_DOWN_EVENT, SwipeDownEvent);
 }
示例#12
0
    /// <summary>
    /// Get the number of stars of the given shape
    /// </summary>
    /// <returns>The shape stars.</returns>
    /// <param name="ID">Shape ID.</param>
    /// <param name="shapesManager">Shapes manager.</param>
    public static TableShape.StarsNumber GetShapeStars(int ID, ShapesManager shapesManager)
    {
        TableShape.StarsNumber stars = TableShape.StarsNumber.ZERO;
        string key = GetStarsStrKey(ID, shapesManager);

        if (PlayerPrefs.HasKey(key))
        {
            stars = CommonUtil.IntNumberToShapeStarsNumberEnum(PlayerPrefs.GetInt(key));
        }
        return(stars);
    }
示例#13
0
    /// <summary>
    /// Determine if is shape locked the specified ID.
    /// </summary>
    /// <returns><c>true</c> if is shape locked the specified ID shapesManager; otherwise, <c>false</c>.</returns>
    /// <param name="ID">I.</param>
    /// <param name="shapesManager">Shapes manager.</param>
    public static bool IsShapeLocked(int ID, ShapesManager shapesManager)
    {
        bool   isLocked = true;
        string key      = GetLockedStrKey(ID, shapesManager);

        if (PlayerPrefs.HasKey(key))
        {
            isLocked = CommonUtil.ZeroOneToTrueFalseBool(PlayerPrefs.GetInt(key));
        }
        return(isLocked);
    }
示例#14
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#15
0
 void Awake()
 {
     mInstance          = this;
     board              = GetComponent <Board> ();
     shapesManager      = GetComponent <ShapesManager> ();
     inputManager       = GetComponent <InputManager> ();
     shapeMove          = GetComponent <ShapeMove> ();
     integrationManager = GetComponent <IntegrationManager> ();
     redimensionManager = GetComponent <RedimensionManager> ();
     combinarManager    = GetComponent <CombinarManager> ();
     levelManager       = GetComponent <LevelManager> ();
 }
示例#16
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
         lastSelectedShape = 0;
     }
     else
     {
         Destroy(gameObject);
     }
 }
        public ActionResult Reflect(string id, string type, string width, string idx)
        {
            // TODO validate parameters
            if (string.IsNullOrEmpty(width))
            {
                width = "0";
            }

            var userName      = User.Identity.Name;
            var shapesManager = new ShapesManager();
            var area          = shapesManager.RegisterShape(id, Int32.Parse(type), double.Parse(width),
                                                            Int32.Parse(idx), userName);

            return(Json(new { area = area.ToString() }));
        }
        private List<TangramShape> shapes; //all the shapes

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create shapes and load them in the scatterview.
        /// </summary>
        /// <param name="level">the level selected by the user</param>
        public MainScatterView(int level)
        {
            InitializeComponent();
            this.mng = new ShapesManager();
            this.shapes = this.mng.getShapes();

            //Shapes generation on the ScatterView
            for (int i = 0; i < this.shapes.Count; i++)
            {
                ScatterViewItem m = mng.minimizeShape(this.shapes[i].getMotherPiece());
                this.scatter.Items.Add(m);
                m.Visibility = (Visibility)1;
                if (this.shapes[i].getLevel == level || level == 0)
                {
                    m.Visibility = (Visibility)0;
                }
            }
        }
        public ActionResult LoadCollection()
        {
            if (!User.Identity.IsAuthenticated)
            {
                Response.StatusCode = 204;
                return(Json(
                           new { result = "" },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            var userName         = User.Identity.Name;
            var shapesManager    = new ShapesManager();
            var shapesCollection = shapesManager.LoadForUser(userName);

            shapesManager.Clear();

            return(Json(
                       new { result = shapesCollection },
                       JsonRequestBehavior.AllowGet
                       ));
        }
示例#20
0
    void Update()
    {
        shapeManager = FindObjectOfType <ShapesManager>();
        int turn = shapeManager.GetTurn();

        if (turn == 1)
        {
            //Check to see if the player has enough resources for this ability and enable its button accordingly
            for (int i = 0; i < resources.Length; i++)
            {
                if (resources[i] > shapeManager.p1Attr[i])
                {
                    buttonEnabled = false;
                    return;
                }
                else
                {
                    buttonEnabled = true;
                }
            }
        }
        else if (turn == 2)
        {
            for (int i = 0; i < resources.Length; i++)
            {
                if (resources[i] > shapeManager.p2Attr[i])
                {
                    buttonEnabled = false;
                    return;
                }
                else
                {
                    buttonEnabled = true;
                }
            }
        }
    }
示例#21
0
    /// <summary>
    /// Get the collected stars for the shapes in the given shapes manager.
    /// </summary>
    /// <returns>The collected stars.</returns>
    /// <param name="shapesManager">Shapes manager.</param>
    public static int GetCollectedStars(ShapesManager shapesManager)
    {
        int ID = 0;
        int cs = 0;

        for (int i = 0; i < shapesManager.shapes.Count; i++)
        {
            ID = (i + 1);
            TableShape.StarsNumber sn = GetShapeStars(ID, shapesManager);
            if (sn == TableShape.StarsNumber.ONE)
            {
                cs += 1;
            }
            else if (sn == TableShape.StarsNumber.TWO)
            {
                cs += 2;
            }
            else if (sn == TableShape.StarsNumber.THREE)
            {
                cs += 3;
            }
        }
        return(cs);
    }
示例#22
0
    // Use this for initialization
    void Start()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        //DontDestroyOnLoad(gameObject);


        menu.onClick.AddListener(GoToMenu);
        level.text = Constants.CurrentLevel.ToString();
        if (Constants.CurrentLevel / 5 < 5)
        {
            BackgroundImage.sprite = Images.ElementAt((Constants.CurrentLevel - 1) / 5);
        }
        else
        {
            BackgroundImage.sprite = Images.ElementAt(4);
        }
        Constants.Mode = Constants.CurrentLevel % 6;
        if (Constants.Mode == 0)
        {
            Constants.Mode = 1;
        }
        switch (Constants.Mode)
        {
        case 1:
            task = string.Format("Собрать {0} за {1}. {2}/{3}", need, Left(), have, need);
            break;

        case 2:
            task = string.Format("Собрать {0} за {1} ходов. {2}/{3}", need, Left(), have, need);
            break;

        case 3:
            task = string.Format("Собрать {0} очков комбинациями с символом локации за {1}. {2}/{3}", need, Left(), have,
                                 need);
            break;

        case 4:
            task = string.Format("Собрать {0} на некой территории за {1}. {2}/{3}", need, Left(), have, need);
            break;

        case 5:
            task = string.Format("Собрать {0} только на закрытой части за {1}. {2}/{3}", need, Left(), have, need);
            break;

        default:
            break;
        }
        TaskText.text = task;
        InitializeTypesOnPrefabShapesAndBonuses();

        InitializeCandyAndSpawnPositions();

        StartCheckForPotentialMatches();
        if (Constants.Mode == 5)
        {
            setBanned(bannedArea1, bannedArea2);
        }
    }
    public override void OnInspectorGUI()
    {
        ShapesManager shapesManager = (ShapesManager)target;                        //get the target

        EditorGUILayout.Separator();

        EditorGUILayout.Separator();
        EditorGUILayout.HelpBox("Follow the instructions below on how to add new shape", MessageType.Info);
        EditorGUILayout.Separator();

        showInstructions = EditorGUILayout.Foldout(showInstructions, "Instructions");
        EditorGUILayout.Separator();

        if (showInstructions)
        {
            EditorGUILayout.HelpBox("- Click on 'Add New Shape' button to add new Shape", MessageType.None);
            EditorGUILayout.HelpBox("- Click on 'Remove Last Shape' button to remove the lastest shape in the list", MessageType.None);
            EditorGUILayout.HelpBox("- Click on 'Apply' button that located at the top to save your changes ", MessageType.None);
        }

        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Review Numbers Tracing", GUILayout.Width(180), GUILayout.Height(25)))
        {
            Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=popularity/query=publisher:9268");
        }

        GUI.backgroundColor = greenColor;

        if (GUILayout.Button("More Assets", GUILayout.Width(110), GUILayout.Height(25)))
        {
            Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=popularity/query=publisher:9268");
        }
        GUI.backgroundColor = whiteColor;

        GUILayout.EndHorizontal();

        EditorGUILayout.Separator();



        GUILayout.BeginHorizontal();
        GUI.backgroundColor = greenColor;

        if (GUILayout.Button("Add New Shape", GUILayout.Width(110), GUILayout.Height(20)))
        {
            shapesManager.shapes.Add(new ShapesManager.Shape());
        }

        GUI.backgroundColor = redColor;
        if (GUILayout.Button("Remove Last Shape", GUILayout.Width(150), GUILayout.Height(20)))
        {
            if (shapesManager.shapes.Count != 0)
            {
                shapesManager.shapes.RemoveAt(shapesManager.shapes.Count - 1);
            }
        }

        GUI.backgroundColor = whiteColor;
        GUILayout.EndHorizontal();

        EditorGUILayout.Separator();

        for (int i = 0; i < shapesManager.shapes.Count; i++)
        {
            shapesManager.shapes [i].showContents = EditorGUILayout.Foldout(shapesManager.shapes [i].showContents, "Shape[" + i + "]");

            if (shapesManager.shapes [i].showContents)
            {
                EditorGUILayout.Separator();
                shapesManager.shapes [i].gamePrefab = EditorGUILayout.ObjectField("Game Prefab", shapesManager.shapes [i].gamePrefab, typeof(GameObject), true) as GameObject;
                EditorGUILayout.Separator();
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(2));
            }
        }

        if (GUI.changed)
        {
            DirtyUtil.MarkSceneDirty();
        }
    }
示例#24
0
 // Use this for initialization
 void Start()
 {
     shapesManager = FindObjectOfType <ShapesManager>();
 }
示例#25
0
 // Use this for initialization
 void Start()
 {
     shapeMan = GameObject.FindGameObjectWithTag("ShapesManager");
     sM       = (ShapesManager)shapeMan.GetComponent(typeof(ShapesManager));
     sM.AddNewShape(this.gameObject);
 }
示例#26
0
    public void Execute()
    {
        shapeManager = FindObjectOfType <ShapesManager>();
        int  turn            = shapeManager.GetTurn();
        bool enoughResources = true;

        if (turn == 1)
        {
            //Check to see if the player has enough resources for this ability
            for (int i = 0; i < resources.Length; i++)
            {
                if (resources[i] > shapeManager.p1Attr[i])
                {
                    enoughResources = false;
                    GameObject.FindObjectOfType <AbilityManager>().enoughResource = false;
                    return;
                }
                else
                {
                    GameObject.FindObjectOfType <AbilityManager>().enoughResource = true;
                }
            }

            //Lock other player's abilities for 1 turn
            if (lockAbilities && enoughResources)
            {
                FindObjectOfType <AbilityManager>().p2Lock = true;
            }
        }
        else if (turn == 2)
        {
            for (int i = 0; i < resources.Length; i++)
            {
                if (resources[i] > shapeManager.p2Attr[i])
                {
                    enoughResources = false;
                    GameObject.FindObjectOfType <AbilityManager>().enoughResource = false;
                    return;
                }
                else
                {
                    GameObject.FindObjectOfType <AbilityManager>().enoughResource = true;
                }
            }

            if (lockAbilities && enoughResources)
            {
                FindObjectOfType <AbilityManager>().p1Lock = true;
            }
        }

        if (enoughResources)
        {
            //Reduce attributes going towards resources
            for (int i = 0; i < resources.Length; i++)
            {
                if (resources[i] != 0)
                {
                    shapeManager.AddAttribute(i, -resources[i], false);
                }
            }

            //Deal damage and score goal if any (apply chance)
            if (Random.value <= chance)
            {
                if (damage != 0)
                {
                    shapeManager.DealDamage(damage / Constants.damageMultiplier);
                }

                if (goal)
                {
                    shapeManager.ScoreGoal();
                }
            }

            //Add to attribute
            if (addAttribute)
            {
                StartCoroutine(shapeManager.ClearBlock(toClear));
                int attrAmount = shapeManager.collectBlockAbilityBlocks;
                if (attrAmount > 0)
                {
                    shapeManager.AddAttribute(toClearIndex, attrAmount, false);
                    shapeManager.collectBlockAbilityBlocks = 0;
                }
            }

            //Drain from opponent's attribute
            if (affectOppenentsAttribute)
            {
                shapeManager.AddAttribute(opponentAttr, drainAmount, true);
            }

            //Convert one block to another
            if (convertBlocks)
            {
                StartCoroutine(shapeManager.ConvertBlock(originalBlock, toConvertBlock));
            }
        }
    }
        public override void OnInspectorGUI()
        {
            ShapesManager shapesManager = (ShapesManager)target;//get the target

            EditorGUILayout.Separator();
            #if !(UNITY_5 || UNITY_2017 || UNITY_2018_0 || UNITY_2018_1 || UNITY_2018_2)
            //Unity 2018.3 or higher
            EditorGUILayout.BeginHorizontal();
            GUI.backgroundColor = Colors.cyanColor;
            EditorGUILayout.Separator();
            if (PrefabUtility.GetPrefabParent(shapesManager.gameObject) != null)
            {
                if (GUILayout.Button("Apply", GUILayout.Width(70), GUILayout.Height(30), GUILayout.ExpandWidth(false)))
                {
                    PrefabUtility.ApplyPrefabInstance(shapesManager.gameObject, InteractionMode.AutomatedAction);
                }
            }
            GUI.backgroundColor = Colors.whiteColor;
            EditorGUILayout.EndHorizontal();
            #endif
            EditorGUILayout.Separator();

            EditorGUILayout.HelpBox("Follow the instructions below on how to add new shape's prefab", MessageType.Info);
            EditorGUILayout.Separator();

            showInstructions = EditorGUILayout.Foldout(showInstructions, "Instructions");
            EditorGUILayout.Separator();

            if (showInstructions)
            {
                EditorGUILayout.HelpBox("- Click on 'Add New Shape' button to add new Shape", MessageType.None);
                EditorGUILayout.HelpBox("- Click on 'Remove Last Shape' button to remove the lastest shape in the list", MessageType.None);
                EditorGUILayout.HelpBox("- Click on ShapesManager 'Apply' button that located at the top to save your changes ", MessageType.None);
            }

            EditorGUILayout.Separator();

            GUILayout.BeginHorizontal();
            GUI.backgroundColor = Colors.greenColor;

            if (GUILayout.Button("Add New Shape", GUILayout.Width(110), GUILayout.Height(20)))
            {
                shapesManager.shapes.Add(new ShapesManager.Shape());
            }

            GUI.backgroundColor = Colors.yellowColor;

            if (GUILayout.Button("More Assets", GUILayout.Width(110), GUILayout.Height(20)))
            {
                Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=popularity/query=publisher:9268");
            }

            GUI.backgroundColor = Colors.whiteColor;
            GUILayout.EndHorizontal();

            EditorGUILayout.Separator();

            for (int i = 0; i < shapesManager.shapes.Count; i++)
            {
                shapesManager.shapes[i].showContents = EditorGUILayout.Foldout(shapesManager.shapes[i].showContents, "Shape[" + i + "]");

                if (shapesManager.shapes[i].showContents)
                {
                    EditorGUILayout.Separator();

                    EditorGUILayout.BeginHorizontal();
                    //EditorGUILayout.Separator();

                    GUI.backgroundColor = Colors.redColor;
                    if (GUILayout.Button("Remove", GUILayout.Width(70), GUILayout.Height(20)))
                    {
                        bool isOk = EditorUtility.DisplayDialog("Confirm Message", "Are you sure that you want to remove the selected shape ?", "yes", "no");

                        if (isOk)
                        {
                            shapesManager.shapes.RemoveAt(i);
                            return;
                        }
                    }
                    GUI.backgroundColor = Colors.whiteColor;
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.Separator();

                    //Shape prefab
                    shapesManager.shapes[i].gamePrefab = EditorGUILayout.ObjectField("Shape Prefab", shapesManager.shapes[i].gamePrefab, typeof(GameObject), true) as GameObject;

                    if (shapesManager.shapes[i].gamePrefab != null)
                    {
                        previewSprite = null;

                        if (shapesManager.shapes[i].gamePrefab.GetComponent <Image>() != null)
                        {
                            previewSprite = shapesManager.shapes[i].gamePrefab.GetComponent <Image>().sprite;
                        }
                        EditorGUILayout.Separator();
                        EditorGUILayout.LabelField("Shape Prefab Preview");

                        EditorGUILayout.ObjectField("", previewSprite, typeof(Sprite), false);
                    }

                    EditorGUILayout.BeginHorizontal();

                    EditorGUI.BeginDisabledGroup(i == shapesManager.shapes.Count - 1);
                    if (GUILayout.Button("▼", GUILayout.Width(22), GUILayout.Height(22)))
                    {
                        MoveDown(i, shapesManager);
                    }
                    EditorGUI.EndDisabledGroup();

                    EditorGUI.BeginDisabledGroup(i - 1 < 0);
                    if (GUILayout.Button("▲", GUILayout.Width(22), GUILayout.Height(22)))
                    {
                        MoveUp(i, shapesManager);
                    }
                    EditorGUI.EndDisabledGroup();

                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(2));
                }

                EditorGUILayout.Separator();
            }

            if (GUI.changed)
            {
                DirtyUtil.MarkSceneDirty();
            }
        }
 private void MoveDown(int index, ShapesManager sm)
 {
     ShapesManager.Shape shape = sm.shapes[index];
     sm.shapes.RemoveAt(index);
     sm.shapes.Insert(index + 1, shape);
 }
示例#29
0
 void Awake()
 {
     shapesManager = GameObject.Find("Manager").GetComponent <ShapesManager>();
 }
    public override void OnInspectorGUI()
    {
        ShapesManager shapesManager = (ShapesManager)target;                        //get the target

        EditorGUILayout.Separator();


        EditorGUILayout.Separator();
        EditorGUILayout.HelpBox("Follow the instructions below on how to add new shape", MessageType.Info);
        EditorGUILayout.Separator();

        showInstructions = EditorGUILayout.Foldout(showInstructions, "Instructions");
        EditorGUILayout.Separator();

        if (showInstructions)
        {
            EditorGUILayout.HelpBox("- Click on 'Add New Shape' button to add new Shape", MessageType.None);
            EditorGUILayout.HelpBox("- Click on 'Remove Last Shape' button to remove the lastest shape in the list", MessageType.None);
            EditorGUILayout.HelpBox("- Click on 'Apply' button that located at the top to save your changes ", MessageType.None);
        }


        EditorGUILayout.Separator();

        shapesManager.shapeLabel  = EditorGUILayout.TextField("Shape Label", shapesManager.shapeLabel);
        shapesManager.shapePrefix = EditorGUILayout.TextField("Shape Prefix", shapesManager.shapePrefix);
        shapesManager.sceneName   = EditorGUILayout.TextField("Scene Name", shapesManager.sceneName);

        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        GUI.backgroundColor = greenColor;

        if (GUILayout.Button("Add New Shape", GUILayout.Width(110), GUILayout.Height(20)))
        {
            shapesManager.shapes.Add(new ShapesManager.Shape());
        }

        GUI.backgroundColor = redColor;
        if (GUILayout.Button("Remove Last Shape", GUILayout.Width(150), GUILayout.Height(20)))
        {
            if (shapesManager.shapes.Count != 0)
            {
                shapesManager.shapes.RemoveAt(shapesManager.shapes.Count - 1);
            }
        }

        GUI.backgroundColor = whiteColor;
        GUILayout.EndHorizontal();

        EditorGUILayout.Separator();

        for (int i = 0; i < shapesManager.shapes.Count; i++)
        {
            shapesManager.shapes [i].showContents = EditorGUILayout.Foldout(shapesManager.shapes [i].showContents, "Shape[" + i + "]");

            if (shapesManager.shapes [i].showContents)
            {
                EditorGUILayout.Separator();
                shapesManager.shapes [i].gamePrefab = EditorGUILayout.ObjectField("Game Prefab", shapesManager.shapes [i].gamePrefab, typeof(GameObject), true) as GameObject;
                shapesManager.shapes [i].picture    = EditorGUILayout.ObjectField("Picture", shapesManager.shapes [i].picture, typeof(Sprite), true) as Sprite;
                EditorGUILayout.Separator();
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(2));
            }
        }

        if (GUI.changed)
        {
            DirtyUtil.MarkSceneDirty();
        }
    }
示例#31
0
 private void Awake()
 {
     shapesManager = GameObject.Find("ShapesManager").GetComponent <ShapesManager>();
     soundManager  = GameObject.Find("SoundManager").GetComponent <SoundManager>();
     //scrollSnap = GameObject.Find("Scroll View").GetComponent<ScrollSnap>();
 }
示例#32
0
 void Start()
 {
     LoadWeapon(weaponType);
     sm = (ShapesManager)GameObject.Find("ShapesManager").GetComponent("ShapesManager");
 }