Example #1
0
        private void OnAddRiddle()
        {
            if (!this._riddleDataHolder.HasValue)
            {
                Debug.Log("Riddle holder doesnt have anyting...");
                return;
            }

            Debug.Log("Riddle should be added...");
            RiddleDataHolder dataHolder = this._riddleDataHolder.Value;

            /* if(dataHolder.title.Length <= 0
            || dataHolder.description.Length <= 0
            || dataHolder.texture == null)
            || {
            ||  return;
            || }
            ||
            || if(!this.editedRiddleSet.HasRiddleSet)
            || {
            ||  return;
            || } */

            GameRiddle riddle = GameRiddle.Create(
                dataHolder.title, dataHolder.description, dataHolder.texture, prefab);

            this.editedRiddleSet.AddRiddle(riddle);
            this._riddleDataHolder = null;
            // TODO: Hide creator ui
        }
Example #2
0
        private void OnImageLoad(ImageLoadedData data)
        {
            if (!this._riddleDataHolder.HasValue)
            {
                this._riddleDataHolder = new RiddleDataHolder();
            }

            RiddleDataHolder valueOfData = this._riddleDataHolder.Value;

            valueOfData.texture    = data.imageTexture;
            this._riddleDataHolder = valueOfData;

            Image         activeImage   = sections.ActiveSection.RiddleImage;
            RectTransform rectTransform = activeImage.rectTransform;
            Rect          activeRect    = rectTransform.rect;

            Rect outputRect;

            this.GetScalarData(out outputRect, activeRect,
                               data.imageTexture.width, data.imageTexture.height);

            Sprite sprite = Sprite.Create(
                data.imageTexture, outputRect,
                Vector2.zero, 100.0f);

            activeImage.type   = Image.Type.Simple;
            activeImage.sprite = sprite;
        }
Example #3
0
        public void OnTitleUpdated(Text updatedTextElement)
        {
            if (!this._riddleDataHolder.HasValue)
            {
                this._riddleDataHolder = new RiddleDataHolder();
            }
            RiddleDataHolder dataHolderValue = this._riddleDataHolder.Value;

            dataHolderValue.title  = updatedTextElement.text;
            this._riddleDataHolder = dataHolderValue;
        }
Example #4
0
        public void OnDescriptionUpdated(Text updatedTextElement)
        {
            if (!this._riddleDataHolder.HasValue)
            {
                this._riddleDataHolder = new RiddleDataHolder();
            }

            RiddleDataHolder dataHolderValue = this._riddleDataHolder.Value;

            dataHolderValue.description = updatedTextElement.text;
            this._riddleDataHolder      = dataHolderValue;
        }