Ejemplo n.º 1
0
    void M8.UIModal.Interface.IPush.Push(M8.GenericParams parms)
    {
        mTextRef = titleDefaultTextRef;
        string text = "";

        if (parms != null)
        {
            if (parms.ContainsKey(parmText))
            {
                mTextRef = null;
                text     = parms.GetValue <string>(parmText);
            }
            else if (parms.ContainsKey(parmTextRef))
            {
                mTextRef = parms.GetValue <string>(parmTextRef);
            }
        }

        if (titleLabel)
        {
            if (!string.IsNullOrEmpty(mTextRef))
            {
                titleLabel.text = M8.Localize.Get(mTextRef);
            }
            else
            {
                titleLabel.text = text;
            }
        }
    }
Ejemplo n.º 2
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        ClearItems();

        mFlagDataIndex = -1;

        mCurIndex = 0;

        mSearchKeywordData  = null;
        mKeywordResultIndex = 0;

        if (parms != null)
        {
            if (parms.ContainsKey(parmSearchKeywordData))
            {
                mSearchKeywordData = parms.GetValue <SearchKeywordData>(parmSearchKeywordData);
            }

            if (parms.ContainsKey(parmSearchKeywordResultIndex))
            {
                mKeywordResultIndex = parms.GetValue <int>(parmSearchKeywordResultIndex);
            }
        }

        //grab which item to use
        FlagData itm = null;

        if (mSearchKeywordData != null)
        {
            titleText.text = string.Format(M8.Localize.Get(titleTextRef), mSearchKeywordData.results[mKeywordResultIndex].text);

            for (int i = 0; i < items.Length; i++)
            {
                var _itm = items[i];
                if (_itm.sourceKeywordData == mSearchKeywordData && _itm.sourceKeywordResultIndex == mKeywordResultIndex)
                {
                    itm            = _itm;
                    mFlagDataIndex = i;
                    break;
                }
            }
        }
        else
        {
        }

        if (itm != null)
        {
            //fill list
            var dats = itm.data;
            for (int i = 0; i < dats.Length; i++)
            {
                AllocateItem(itm, i);
            }

            UpdateSelectFlag();
        }

        scroller.normalizedPosition = new Vector2(0f, 1f);
    }
Ejemplo n.º 3
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        ResetDisplay();

        int ind = -1;

        if (parms != null)
        {
            if (parms.ContainsKey(parmTitle))
            {
                titleText.text = parms.GetValue <string>(parmTitle);
            }

            if (parms.ContainsKey(parmIndex))
            {
                ind = parms.GetValue <int>(parmIndex);
            }
        }

        if (ind != -1 && ind < categoryGroups.Length)
        {
            var cat = categoryGroups[ind];

            for (int i = 0; i < cat.categories.Length; i++)
            {
                var key = cat.categories[i];
                if (mCategories.ContainsKey(key))
                {
                    mCategories[key].SetActive(true);
                }
            }
        }
    }
Ejemplo n.º 4
0
    public override void Push(M8.GenericParams parms)
    {
        base.Push(parms);

        mRefs = parms.GetValue <PairRef[]>(parmPairRefs);

        var parmPairs = parms.GetValue <PairRef[]>(parmPairRefs);

        List <PairRef> parsedRefs = new List <PairRef>();

        for (int i = 0; i < parmPairs.Length; i++)
        {
            var parsed = Utility.GrabLocalizeGroup(parmPairs[i].stringRef);
            for (int j = 0; j < parsed.Length; j++)
            {
                var newRef = new PairRef()
                {
                    compositeName = parmPairs[i].compositeName, clear = parmPairs[i].clear, stringRef = parsed[j]
                };
                parsedRefs.Add(newRef);
            }
        }

        mRefs      = parsedRefs.ToArray();
        mCurRefInd = 0;
    }
Ejemplo n.º 5
0
    void M8.UIModal.Interface.IPush.Push(M8.GenericParams parms)
    {
        mIndex = 0;

        if (parms != null)
        {
            mTransfer = parms.GetValue <TracerGraphControl>(parmTransferTraceGraph);
            mIndex    = parms.GetValue <int>(parmIndex);
        }

        //apply index
        for (int i = 0; i < counts.Length; i++)
        {
            var count = counts[i];

            if (i < mIndex)
            {
                count.animator.Play(count.takeFilled);
            }
            else if (i >= mIndex)
            {
                count.animator.Play(count.takeEmpty);
            }
        }

        //apply transfer
        if (mTransfer)
        {
            mTransferLastParent = mTransfer.transform.parent;
            mTransfer.transform.SetParent(transferRoot, false);
            mTransfer.transform.localPosition = Vector3.zero;
            mTransfer.transform.localScale    = Vector3.one;
        }
    }
Ejemplo n.º 6
0
    protected override void OnSpawned(M8.GenericParams parms)
    {
        //populate data/state for ai, player control, etc.
        int       toState  = (int)EntityState.Normal;
        Transform toAnchor = null;

        if (parms != null)
        {
            if (parms.ContainsKey(Params.state))
            {
                toState = parms.GetValue <int>(Params.state);
            }

            if (parms.ContainsKey(Params.anchor))
            {
                toAnchor = parms.GetValue <Transform>(Params.anchor);
            }
        }

        //start ai, player control, etc
        anchor = toAnchor;
        state  = toState;

        if (mStats.data.registerAsEnemy)
        {
            MissionController.instance.Signal(MissionController.SignalType.EnemyRegister, this);
        }
    }
Ejemplo n.º 7
0
    void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
    {
        mCellIndex = new GridCell {
            b = 0, row = 0, col = 0
        };
        _cellSize = new GridCell {
            b = 1, row = 1, col = 1
        };


        if (parms != null)
        {
            if (parms.ContainsKey(parmData))
            {
                _data = parms.GetValue <GridEntityData>(parmData);
            }

            if (parms.ContainsKey(parmCellIndex))
            {
                mCellIndex = parms.GetValue <GridCell>(parmCellIndex);
            }

            if (parms.ContainsKey(parmCellSize))
            {
                _cellSize = parms.GetValue <GridCell>(parmCellSize);
            }
        }

        container.AddEntity(this);

        RefreshPosition();
        RefreshBounds();
    }
Ejemplo n.º 8
0
    void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
    {
        if (parms != null)
        {
            if (parms.ContainsKey(parmDir))
            {
                mDir = parms.GetValue <Vector2>(parmDir);
            }

            if (parms.ContainsKey(parmForce))
            {
                float f = parms.GetValue <float>(parmForce);
                mForce = mDir * f;
            }

            if (parms.ContainsKey(parmDuration))
            {
                mDuration = parms.GetValue <float>(parmDuration);
            }
            else
            {
                mDuration = defaultDuration;
            }
        }
    }
Ejemplo n.º 9
0
    void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
    {
        GameMapController.instance.paletteUpdateCallback       += OnPaletteUpdate;
        GameMapController.instance.blockSelectedChangeCallback += OnGameBlockSelectChange;
        GameMapController.instance.modeChangeCallback          += OnGameChangeMode;

        BlockInfo blockInf  = parms.GetValue <BlockInfo>(paramBlockInfo);
        bool      showIntro = parms.GetValue <bool>(paramShowIntro);

        //setup data
        mBlockName = blockInf.name;

        //setup state
        UpdateInteractible();

        //setup display
        blockNameText.text = M8.Localize.Get(blockInf.nameDisplayRef);

        blockImage.sprite = blockInf.icon;

        UpdateCount();

        ApplySelected(isSelected);

        //show intro?
        if (showIntro)
        {
            //animation
        }

        if (disableGO)
        {
            disableGO.SetActive(false);
        }
    }
Ejemplo n.º 10
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        if (parms != null)
        {
            if (parms.ContainsKey(parmPortraitSprite))
            {
                SetupPortraitTextContent(parms.GetValue <Sprite>(parmPortraitSprite), parms.GetValue <string>(parmNameTextRef), parms.GetValue <string>(parmDialogTextRef));
            }
            else
            {
                SetupTextContent(parms.GetValue <string>(parmNameTextRef), parms.GetValue <string>(parmDialogTextRef));
            }

            mNextCallback = parms.GetValue <System.Action>(parmNextCallback);
        }

        if (textProcessActiveGO)
        {
            textProcessActiveGO.SetActive(false);
        }
        if (textProcessFinishGO)
        {
            textProcessFinishGO.SetActive(false);
        }

        mIsNextProcessed = false;
    }
Ejemplo n.º 11
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        mDescTextRef  = null;
        mIsDescSpoken = false;
        mCallback     = null;

        if (parms != null)
        {
            if (parms.ContainsKey(parmTitleTextRef))
            {
                if (titleText)
                {
                    titleText.text = M8.Localize.Get(parms.GetValue <string>(parmTitleTextRef));
                }
            }

            if (parms.ContainsKey(parmDescTextRef))
            {
                mDescTextRef = parms.GetValue <string>(parmDescTextRef);
                if (descText)
                {
                    descText.text = M8.Localize.Get(mDescTextRef);
                }
            }

            if (parms.ContainsKey(parmCallback))
            {
                mCallback = parms.GetValue <System.Action <bool> >(parmCallback);
            }
        }
    }
Ejemplo n.º 12
0
    void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
    {
        if (parms != null)
        {
            if (parms.ContainsKey(parmDir))
            {
                mDir = parms.GetValue <Vector2>(parmDir);
            }
            else
            {
                mDir = dir;
            }

            if (parms.ContainsKey(parmSpeed))
            {
                mInitSpeed = parms.GetValue <float>(parmSpeed);
            }
            else
            {
                mInitSpeed = initialSpeed;
            }

            if (parms.ContainsKey(parmAccel))
            {
                mAccel = parms.GetValue <float>(parmAccel);
            }
            else
            {
                mAccel = accel;
            }
        }
    }
Ejemplo n.º 13
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        titleText.text = "";
        mCallback      = null;
        mDelay         = 0f;

        if (parms != null)
        {
            if (parms.ContainsKey(parmDelay))
            {
                mDelay = parms.GetValue <float>(parmDelay);
            }

            if (parms.ContainsKey(parmTitleString))
            {
                titleText.text = parms.GetValue <string>(parmTitleString);
            }

            if (parms.ContainsKey(parmCallback))
            {
                mCallback = parms.GetValue <System.Action>(parmCallback);
            }
        }

        SetProgress(0f);
    }
Ejemplo n.º 14
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        bool closeShow = false;
        int  index     = -1;

        if (parms != null)
        {
            if (parms.ContainsKey(parmCycleIndex))
            {
                index = parms.GetValue <int>(parmCycleIndex);
            }

            if (parms.ContainsKey(parmShowClose))
            {
                closeShow = parms.GetValue <bool>(parmShowClose);
            }
        }

        for (int i = 0; i < groups.Length; i++)
        {
            groups[i].SetActive(i == index);
        }

        if (backGO)
        {
            backGO.SetActive(closeShow);
        }
        if (closeGO)
        {
            closeGO.SetActive(closeShow);
        }
    }
Ejemplo n.º 15
0
    void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
    {
        Init();

        Sprite spr = mDefaultSprite;
        Color  clr = mDefaultColor;

        Vector2 pos = Vector2.zero;
        float   rot = 0f;

        if (parms != null)
        {
            if (parms.ContainsKey(parmPosition))
            {
                pos = parms.GetValue <Vector2>(parmPosition);
            }
            if (parms.ContainsKey(parmRotation))
            {
                rot = parms.GetValue <float>(parmRotation);
            }
            if (parms.ContainsKey(parmSprite))
            {
                spr = parms.GetValue <Sprite>(parmSprite);
            }
            if (parms.ContainsKey(parmColor))
            {
                clr = parms.GetValue <Color>(parmColor);
            }
        }

        bool isInit = jellySprite.CentralPoint != null;

        if (isInit)
        {
            //need to reinitialize mesh/material?
            bool isSpriteChanged = jellySprite.m_Sprite != spr;
            bool isColorChanged  = jellySprite.m_Color != clr;

            jellySprite.m_Sprite = spr;
            jellySprite.m_Color  = clr;

            if (isColorChanged || isSpriteChanged)
            {
                jellySprite.RefreshMesh(); //just to ensure sprite uv's are properly applied
            }
            //else if(isSpriteChanged)
            //jellySprite.ReInitMaterial();

            //reset and apply telemetry
            jellySprite.Reset(pos, new Vector3(0f, 0f, rot));
        }
        else
        {
            //directly apply telemetry
            var trans = jellySprite.transform;
            trans.position    = pos;
            trans.eulerAngles = new Vector3(0f, 0f, rot);
        }
    }
Ejemplo n.º 16
0
    void M8.UIModal.Interface.IPush.Push(M8.GenericParams parms)
    {
        if (image)
        {
            Sprite spr;
            if (parms.TryGetValue(parmImage, out spr) && spr)
            {
                image.gameObject.SetActive(true);
                image.sprite = spr;
                if (isImageResize)
                {
                    image.SetNativeSize();
                }
            }
            else
            {
                image.gameObject.SetActive(false);
            }
        }

        mTitleTextRef = parms.GetValue <string>(parmTitleTextRef);
        mDescTextRef  = parms.GetValue <string>(parmDescTextRef);

        if (titleLabel)
        {
            if (!string.IsNullOrEmpty(mTitleTextRef))
            {
                titleLabel.gameObject.SetActive(true);
                titleLabel.text = M8.Localize.Get(mTitleTextRef);
            }
            else
            {
                titleLabel.gameObject.SetActive(false);
            }
        }

        if (descLabel)
        {
            if (!string.IsNullOrEmpty(mDescTextRef))
            {
                descLabel.gameObject.SetActive(true);
                descLabel.text = M8.Localize.Get(mDescTextRef);
            }
            else
            {
                descLabel.gameObject.SetActive(false);
            }
        }

        if (mTitleLabelSpeakText)
        {
            mTitleLabelSpeakText.key = mTitleTextRef;
        }
        if (mDescLabelSpeakText)
        {
            mDescLabelSpeakText.key = mDescTextRef;
        }
    }
Ejemplo n.º 17
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        ClearItems();

        mProceedCallback = null;

        if (parms != null)
        {
            if (parms.ContainsKey(parmSearchType))
            {
                mSearchType = parms.GetValue <SearchType>(parmSearchType);
            }

            if (parms.ContainsKey(parmSearchKeywordData))
            {
                mSearchKeywordData = parms.GetValue <SearchKeywordData>(parmSearchKeywordData);
            }

            if (parms.ContainsKey(parmProceedCallback))
            {
                mProceedCallback = parms.GetValue <ProceedCallback>(parmProceedCallback);
            }
        }

        if (mSearchKeywordData)
        {
            titleText.text = string.Format(M8.Localize.Get(titleTextRef), mSearchKeywordData.key);

            //populate list
            var results = mSearchKeywordData.results;
            for (int i = 0; i < results.Length; i++)
            {
                var result = results[i];

                if (result.IsSearchMatch(mSearchType))
                {
                    AllocateItem(i, result);
                }
            }

            if (mItemActive.Count > 0)
            {
                mCurIndex = mItemActive[0].index;
                UpdateSelectedItemFlag();

                flagButtonRootGO.SetActive(true);
                proceedSelectible.interactable = true;
            }
            else
            {
                flagButtonRootGO.SetActive(false);
                proceedSelectible.interactable = false;
            }
        }

        //init scroller
        scroller.normalizedPosition = Vector2.zero;
    }
Ejemplo n.º 18
0
    void M8.UIModal.Interface.IPush.Push(M8.GenericParams parms)
    {
        if (parms != null)
        {
            int count = parms.GetValue <int>(parmTargetCount);
            Setup(count);

            mAutoCrossCount = parms.GetValue <int>(parmTargetCrossCount);
        }
    }
Ejemplo n.º 19
0
    void IPush.Push(M8.GenericParams parms)
    {
        //throw new NotImplementedException();
        mTotalTime = parms.GetValue <float>(parmTime);
        mScoreMult = parms.GetValue <float>(parmMult);

        mTotalScore = mTotalTime * mScoreMult;

        timeText.text        = Utility.TimerFormat(mTotalTime);
        scoreMultText.text   = "x" + mScoreMult;
        scoreResultText.text = "+0";
    }
Ejemplo n.º 20
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        double val = 0;

        if (parms != null)
        {
            if (parms.ContainsKey(parmInitValue))
            {
                object obj = parms.GetValue <object>(parmInitValue);
                if (obj is float)
                {
                    val = (float)obj;
                }
                else if (obj is double)
                {
                    val = (double)obj;
                }
                else if (obj is int)
                {
                    val = (int)obj;
                }
                else
                {
                    val = 0;
                }
            }

            if (parms.ContainsKey(parmMaxDigit))
            {
                mMaxDigits = parms.GetValue <int>(parmMaxDigit);
                if (mMaxDigits <= 0)
                {
                    mMaxDigits = _defaultMaxDigits;
                }
            }
            else
            {
                mMaxDigits = _defaultMaxDigits;
            }
        }

        SetCurrentValue(val);

        if (signalValueChanged)
        {
            signalValueChanged.callback += OnValueChanged;
        }
    }
Ejemplo n.º 21
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        switch (mode)
        {
        case Mode.None:
            mSelect = null;
            break;

        case Mode.Previous:
            var es = EventSystem.current;
            if (es)
            {
                mSelect = es.currentSelectedGameObject;
            }
            else
            {
                mSelect = null;
            }
            break;

        case Mode.Param:
            if (parms != null && parms.ContainsKey(parmSelectGO))
            {
                mSelect = parms.GetValue <GameObject>(parmSelectGO);
            }
            else
            {
                mSelect = null;
            }
            break;
        }
    }
Ejemplo n.º 22
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        mIsInspection = false;

        if (parms != null)
        {
            if (parms.ContainsKey(parmIsInspection))
            {
                mIsInspection = parms.GetValue <bool>(parmIsInspection);
            }
        }

        scroller.normalizedPosition = new Vector2(0f, 1f);

        mItems[mItemFlaggableInd].isFlagged = ipFlaggedItem.isFlagged;

        if (mIsInspection)
        {
            mCurIndex = 0;
            UpdateSelected();

            inspectSelectable.gameObject.SetActive(true);
        }
        else
        {
            inspectSelectable.gameObject.SetActive(false);
        }
    }
Ejemplo n.º 23
0
    void M8.UIModal.Interface.IPush.Push(M8.GenericParams parms)
    {
        if (parms != null)
        {
            if (parms.ContainsKey(parmPortraitSprite))
            {
                SetupPortraitTextContent(parms.GetValue <Sprite>(parmPortraitSprite), parms.GetValue <string>(parmNameTextRef), parms.GetValue <string>(parmDialogTextRef));
            }
            else
            {
                SetupTextContent(parms.GetValue <string>(parmNameTextRef), parms.GetValue <string>(parmDialogTextRef));
            }

            mNextCallback = parms.GetValue <System.Action>(parmNextCallback);
        }
    }
Ejemplo n.º 24
0
    void IPush.Push(M8.GenericParams parms)
    {
        if (!mPaused)
        {
            mPaused = true;
            M8.SceneManager.instance.Pause();
        }

        bool showGiveUp = false;

        if (parms != null)
        {
            if (parms.ContainsKey(parmShowGiveUp))
            {
                showGiveUp = parms.GetValue <bool>(parmShowGiveUp);
            }
        }

        //show give up?
        if (showGiveUp)
        {
            giveUpGO.SetActive(true);
            giveUpButton.interactable = true;
        }
        else
        {
            giveUpGO.SetActive(false);
        }
    }
Ejemplo n.º 25
0
    public override void Push(M8.GenericParams parms)
    {
        base.Push(parms);

        var parmPairs = parms.GetValue <PairRef[]>(parmPairRefs);

        List <PairRef> parsedRefs = new List <PairRef>();

        for (int i = 0; i < parmPairs.Length; i++)
        {
            var parsed = Utility.GrabLocalizeGroup(parmPairs[i].stringRef);
            for (int j = 0; j < parsed.Length; j++)
            {
                var newRef = new PairRef()
                {
                    sprite = parmPairs[i].sprite, stringRef = parsed[j]
                };
                parsedRefs.Add(newRef);
            }
        }

        mRefs      = parsedRefs.ToArray();
        mCurRefInd = 0;

        imageDisplay.gameObject.SetActive(false);
        mIsImageShown = false;
    }
Ejemplo n.º 26
0
        void IModalPush.Push(GenericParams parms)
        {
            string title       = "";
            string description = "";
            object icon        = null;

            if (parms != null)
            {
                title       = parms.GetValue <string>(paramTitle);
                description = parms.GetValue <string>(paramDesc);
                icon        = parms.GetValue <object>(paramIconRef);

                mChoiceCallback = parms.GetValue <System.Action <int> >(paramCallback);
            }

            Setup(title, description, icon);
        }
Ejemplo n.º 27
0
 void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
 {
     //grab drag cursor
     if (parms != null)
     {
         var dragCursorObj = parms.GetValue <object>(EntitySpawnerWidget.parmDragWorld);
         dragWorldSurfaceSnap = dragCursorObj as DragCursorWorldSurfaceSnap;
     }
 }
Ejemplo n.º 28
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        if (parms != null)
        {
            if (parms.ContainsKey(parmFilename))
            {
                fileText.text = parms.GetValue <string>(parmFilename);
            }

            if (parms.ContainsKey(parmMalwareData))
            {
                var malware = parms.GetValue <MalwareData>(parmMalwareData);

                malwareTitleText.text  = M8.Localize.Get(malware.titleRef);
                malwareDetailText.text = M8.Localize.Get(malware.detailRef);
            }
        }
    }
Ejemplo n.º 29
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        titleText.text = "";
        bodyText.text  = "";

        if (parms != null)
        {
            if (parms.ContainsKey(parmTitle))
            {
                titleText.text = parms.GetValue <string>(parmTitle);
            }

            if (parms.ContainsKey(parmText))
            {
                bodyText.text = parms.GetValue <string>(parmText);
            }
        }
    }
Ejemplo n.º 30
0
    protected override void OnSpawned(M8.GenericParams parms)
    {
        //populate data/state for ai, player control, etc.

        //start ai, player control, etc

        if (parms != null)
        {
            if (parms.ContainsKey(parmPosition))
            {
                Vector2 pt;

                object ptObj = parms.GetValue <object>(parmPosition);
                if (ptObj is Vector2)
                {
                    pt = (Vector2)ptObj;
                }
                else if (ptObj is Vector3)
                {
                    pt = (Vector3)ptObj;
                }
                else
                {
                    pt = position;
                }

                position = pt;
            }

            if (parms.ContainsKey(parmNormal))
            {
                Vector2 norm = parms.GetValue <Vector2>(parmNormal);
                transform.rotation = Quaternion.AngleAxis(Vector2.SignedAngle(Vector2.up, norm), Vector3.forward);
            }
        }

        if (stateOnSpawn)
        {
            state = stateOnSpawn;
        }

        spawnEvent.Invoke();
    }