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)
    {
        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.º 3
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.º 4
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.º 5
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.º 6
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.º 7
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.º 8
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.º 9
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.º 10
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.º 11
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.º 12
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.º 13
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.º 14
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.º 15
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.º 16
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.º 17
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.º 18
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.º 19
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.º 20
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();
    }
Ejemplo n.º 21
0
 void IPoolSpawn.OnSpawned(GenericParams parms)
 {
     if (parms != null && parms.ContainsKey(parmState))
     {
         mToState = parms.GetValue <State>(parmState);
     }
     else
     {
         mToState = spawnDefaultState;
     }
 }
Ejemplo n.º 22
0
    //void Awake() {
    //}

    void M8.UIModal.Interface.IPush.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
                {
                    val = 0;
                }
            }

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

        SetCurrentValue(val);

        ClearInput();
    }
Ejemplo n.º 23
0
    void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
    {
        mForceScale = 1f;

        if (parms != null)
        {
            if (parms.ContainsKey(parmForceScale))
            {
                mForceScale = parms.GetValue <float>(parmForceScale);
            }
        }
    }
Ejemplo n.º 24
0
    void M8.IPoolSpawn.OnSpawned(M8.GenericParams parms)
    {
        if (!mPoolData)
        {
            mPoolData = GetComponent <M8.PoolDataController>();
        }

        SpriteShape spriteShape = null;
        Vector2     dir         = Vector2.zero;

        if (parms != null)
        {
            if (parms.ContainsKey(parmSpriteShape))
            {
                spriteShape = parms.GetValue <SpriteShape>(parmSpriteShape);
            }
            if (parms.ContainsKey(parmDir))
            {
                dir = parms.GetValue <Vector2>(parmDir);
            }
        }

        if (spriteShape)
        {
            spriteShapeCtrl.spriteShape = spriteShape;
        }

        transform.localEulerAngles = new Vector3(0f, 0f, Random.Range(0f, 360f));

        spriteShapeCtrl.enabled = true;

        mBody.simulated = true;

        dir = M8.MathUtil.RotateAngle(dir, dirAngleRange.random);
        mBody.AddForce(dir * impulseRange.random, ForceMode2D.Impulse);

        spriteShapeCtrl.spriteShapeRenderer.color = mDefaultColor;

        StartCoroutine(DoAlive());
    }
Ejemplo n.º 25
0
    public virtual void Push(M8.GenericParams parms)
    {
        if (parms != null && parms.ContainsKey(parmInfoData))
        {
            infoData = parms.GetValue <InfoData>(parmInfoData);
        }
        else
        {
            infoData = null;
        }

        ApplyInfoData();
    }
Ejemplo n.º 26
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        //set defaults
        titleText.text = "";

        mCommitCallback = null;

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

            if (parms.ContainsKey(parmCallback))
            {
                mCommitCallback = parms.GetValue <CommitCallback>(parmCallback);
            }
        }

        //fill up search items from GameData.searchKeywords
        mSearchKeywords = new List <SearchKeywordData>(GameData.instance.searchKeywords);
        //mSearchKeywords.Sort();

        var options = new List <string>(mSearchKeywords.Count);

        for (int i = 0; i < mSearchKeywords.Count; i++)
        {
            options.Add(mSearchKeywords[i].key);
        }

        dropdown.ClearOptions();
        dropdown.AddOptions(options);

        searchSelectible.interactable = options.Count > 0;
        //
    }
Ejemplo n.º 27
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        mIgnoreNewlySeen = false;

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

        //initialize
        if (igneousList.items == null)
        {
            var rocks = inventory.rocksIgneous;
            igneousList.Init(itemTemplate, rocks, mIgnoreNewlySeen);
        }
        else
        {
            igneousList.ApplyIgnoreNewlySeen(mIgnoreNewlySeen);
        }

        if (sedimentaryList.items == null)
        {
            var rocks = inventory.rocksSedimentary;
            sedimentaryList.Init(itemTemplate, rocks, mIgnoreNewlySeen);
        }
        else
        {
            sedimentaryList.ApplyIgnoreNewlySeen(mIgnoreNewlySeen);
        }

        if (metamorphicList.items == null)
        {
            var rocks = inventory.rocksMetamorphic;
            metamorphicList.Init(itemTemplate, rocks, mIgnoreNewlySeen);
        }
        else
        {
            metamorphicList.ApplyIgnoreNewlySeen(mIgnoreNewlySeen);
        }

        //refresh display
        igneousList.RefreshDisplay();
        sedimentaryList.RefreshDisplay();
        metamorphicList.RefreshDisplay();
    }
Ejemplo n.º 28
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.º 29
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        ShapeCategoryData dat = null;

        if (parms != null)
        {
            if (parms.ContainsKey(parmShapeCategoryData))
            {
                dat = parms.GetValue <ShapeCategoryData>(parmShapeCategoryData);
            }
        }

        if (dat)
        {
            categoryWidget.Setup(dat);
        }
    }
Ejemplo n.º 30
0
    void M8.IModalPush.Push(M8.GenericParams parms)
    {
        if (parms != null)
        {
            if (parms.ContainsKey(parmShapes))
            {
                mShapeCategories = parms.GetValue <ShapeCategoryData[]>(parmShapes);
            }
        }

        mCurShapeCategoryIndex = 0;

        prevButton.interactable = false;
        nextButton.interactable = false;

        exitGO.SetActive(false);

        ApplyCurrent();
    }