Пример #1
0
    private TransactionBoxManager()
    {
        transactionBoxParent = null;
        boxObjects           = null;
        boxComponents        = null;
        boxSourceObjects     = null;
        boxSourceListeners   = null;
        boxSourceDistances   = null;
        boxTryAboves         = null;
        boxTailObjects       = null;
        boxTailRenderers     = null;
        symbolDatabase       = null;
        boxDatabase          = null;
        boxAppearanceIndex   = -1;
        bodySprite           = null;
        tailSprite           = null;
        tailWidth            = 0f;
        tailHeight           = 0f;
        tailHalfWidth        = 0f;
        tailHalfHeight       = 0f;
        cameraObject         = null;
        cameraController     = null;
        cameraWidth          = 0f;
        cameraHeight         = 0f;
        cameraHalfWidth      = 0f;
        cameraHalfHeight     = 0f;
        boxDepth             = DisplayDepthManager.GetElementDepth(DisplayDepthManager.ELEMENT_CODE_TRANSACTION);
        boxLimits            = new Vector2(TextBox.DEFAULT_MAX_BOX_WIDTH, TextBox.DEFAULT_MAX_BOX_HEIGHT);

        transactionBoxParent = new GameObject("TransactionBoxParent");
        transactionBoxParent.transform.position = new Vector3(0f, 0f, boxDepth);
    }
Пример #2
0
    public void Awake()
    {
        _manager        = GetComponentInParent <GameManager>();
        _symbolDatabase = GetComponentInParent <SymbolDatabase>();

        _manager.IsPlayingChanged += ManagerOnIsPlayingChanged;
    }
Пример #3
0
    public void SetMaterials(SymbolDatabase newSymbolDatabase, BoxAppearanceDatabase newBoxDatabase)
    {
        Sprite bodySprite = null;
        Sprite tailSprite = null;

        symbolDatabase = newSymbolDatabase;
        boxDatabase    = newBoxDatabase;
        if (boxDatabase != null)
        {
            if (!boxDatabase.GetBoxAppearance(BoxAppearanceDatabase.BoxPurpose.System, 0, ref bodySprite, ref tailSprite))
            {
                boxAppearanceIndex = -1;
                bodySpriteSystem   = null;
                bodySpriteDialogue = null;
                tailSpriteDialogue = null;
            }
            else
            {
                boxAppearanceIndex = 0;
                bodySpriteSystem   = bodySprite;
                boxDatabase.GetBoxAppearance(BoxAppearanceDatabase.BoxPurpose.Dialogue, 0, ref bodySprite, ref tailSprite);
                bodySpriteDialogue = bodySprite;
                tailSpriteDialogue = tailSprite;
            }
        }
        ExtractTailDimensions();
    }
Пример #4
0
 public virtual void SetGameController(GameController newGameController, Canvas newInterfaceCanvas, GameObject newImageOverlayModel,
                                       EventManager newEventManager)
 {
     gameController = newGameController;
     if (gameController != null)
     {
         font = gameController.GetSymbolDatabaseUI();
     }
     interfaceCanvasObject    = null;
     interfaceCanvasTrans     = null;
     interfaceCanvasComponent = newInterfaceCanvas;
     if (interfaceCanvasComponent != null)
     {
         interfaceCanvasObject = interfaceCanvasComponent.gameObject;
         interfaceCanvasTrans  = interfaceCanvasObject.GetComponent <RectTransform>();
         if (interfaceCanvasTrans != null)
         {
             interfaceCanvasRect       = interfaceCanvasTrans.rect;
             interfaceCanvasScreenRect = interfaceCanvasComponent.pixelRect;
             //Debug.Log("Debug : MenuSimple : interface canvas reference rect = "+interfaceCanvasRect+".");
             //Debug.Log("Debug : MenuSimple : interface canvas actual screen Rect = "+interfaceCanvasScreenRect+".");
         }
         else
         {
             interfaceCanvasComponent = null;
             interfaceCanvasObject    = null;
         }
     }
     imageOverlayModel = newImageOverlayModel;
     eventManager      = newEventManager;
 }
Пример #5
0
 public void SetSymbolSource(SymbolDatabase newSpriteSource)
 {
     spriteSource = newSpriteSource;
     if (spriteSource != null)
     {
         fontModMaterial = spriteSource.fontModMaterial;
     }
 }
Пример #6
0
 public virtual void Clear()
 {
     ClearVisualRepresentation(true);
     totalValidModels              = 0;
     totalValidOptionModels        = null;
     totalValidOptionScales        = null;
     totalValidOptionChoiceEffects = null;
     totalValidOptionEventIDs      = null;
     font = null;
 }
    public void Start()
    {
        // both of these are acuaried by looking in the herarchy
        _symbolDatabase = GetComponentInParent <SymbolDatabase>();
        _gameOptions    = GetComponentInParent <GameOptions>();

        GameBoard.TilePlaced      += GameBoardOnTilePlaced;
        GameBoard.TileRejected    += GameBoardOnTileRejected;
        GameBoard.AllTilesMatched += GameBoardOnAllTilesMatched;
    }
    public void Start()
    {
        _gameBoard      = GetComponentInChildren <GameBoard>();
        _manager        = GetComponent <GameManager>();
        _gameOptions    = GetComponent <GameOptions>();
        _symbolDatabase = GetComponent <SymbolDatabase>();

        _gameBoard.TileRejected    += GameBoardOnTileRejected;
        _gameBoard.TilePlaced      += GameBoardOnTilePlaced;
        _gameBoard.AllTilesMatched += GameBoardOnAllTilesMatched;
    }
Пример #9
0
    private TextBoxManager()
    {
        textBoxParent      = null;
        boxObjects         = null;
        boxComponents      = null;
        boxMasterEvents    = null;
        boxQuestionRoles   = null;
        boxOptionIndexes   = null;
        boxSpeakerIDs      = null;
        boxTryAboves       = null;
        boxTailObjects     = null;
        boxTailRenderers   = null;
        symbolDatabase     = null;
        boxDatabase        = null;
        boxAppearanceIndex = -1;
        bodySpriteSystem   = null;
        bodySpriteDialogue = null;
        tailSpriteDialogue = null;
        tailWidth          = 0f;
        tailHeight         = 0f;
        tailHalfWidth      = 0f;
        tailHalfHeight     = 0f;
        stage                  = null;
        cameraObject           = null;
        cameraController       = null;
        cameraWidth            = 0f;
        cameraHeight           = 0f;
        cameraHalfWidth        = 0f;
        cameraHalfHeight       = 0f;
        cameraPixelWidth       = 0;
        cameraPixelHeight      = 0;
        boxDepth               = DisplayDepthManager.GetElementDepth(DisplayDepthManager.ELEMENT_CODE_TEXT);
        systemBoxLimits        = new Vector2(TextBox.DEFAULT_MAX_BOX_WIDTH, TextBox.DEFAULT_MAX_BOX_HEIGHT);
        systemBoxTopOffset     = 0f;
        dialogueBoxLimits      = new Vector2(DialogueBox.DEFAULT_MAX_D_BOX_WIDTH, DialogueBox.DEFAULT_MAX_D_BOX_HEIGHT);
        questionDelegate       = null;
        enunciateBoxTopOffset  = 0f;
        enunciateBoxComponent  = null;
        optionsToAllocate      = 0;
        optionAreaHeight       = 0f;
        optionHalfAreaHeight   = 0f;
        optionBoxTopOffset     = 0f;
        optionAwaitedIndex     = -1;
        optionChosenIndex      = -1;
        optionIndexConfirm     = -1;
        optionIndexCancel      = -1;
        optionComponentConfirm = null;
        optionComponentCancel  = null;
        paused                 = false;

        textBoxParent = new GameObject("TextBoxParent");
        textBoxParent.transform.position = new Vector3(0f, 0f, boxDepth);
    }
Пример #10
0
 /*halmeida - carefull when using this method. If any memory is currently allocated, it will not be freed.*/
 protected virtual void ResetAllClassFields()
 {
     if (cleared)
     {
         symbolDatabase     = null;
         maxBoxWidth        = DEFAULT_MAX_BOX_WIDTH;
         maxBoxHeight       = DEFAULT_MAX_BOX_HEIGHT;
         minBoxHeight       = 0f;
         maxTextWidth       = 0f;
         maxTextHeight      = 0f;
         boxSprite          = null;
         boxObject          = null;
         boxRenderer        = null;
         boxArea            = new Rect(0f, 0f, 0f, 0f);
         textArea           = new Rect(0f, 0f, 0f, 0f);
         margin             = 0f;
         marginDouble       = 0f;
         lineHeight         = 0f;
         maxLineWidth       = 0f;
         maxLinesPerPage    = 0;
         pageFirstLineIndex = -1;
         pageLastLineIndex  = -1;
         built              = false;
         open               = false;
         opening            = false;
         written            = false;
         closing            = false;
         closed             = false;
         cleared            = false;
         instantCreation    = false;
         reactionType       = ReactionType.ReactAnywhere;
         boxToTextDepth     = -DisplayDepthManager.ELEMENT_TO_ELEMENT_OFFSET / 100f;
         textAlignment      = TextAlignment.AlignLeft;
         text               = null;
         textLines          = null;
         textLineObjects    = null;
         textLineComponents = null;
         textLinesReady     = false;
         textSpeed          = DEFAULT_TEXT_SPEED;
         currentLine        = null;
         currentLineIndex   = -1;
         currentSymbolIndex = -1;
         currentLineLength  = 0;
         symbolDuration     = 0f;
         symbolElapsed      = 0f;
         writeImmediately   = false;
         autoClose          = false;
         autoCloseDuration  = 0f;
         autoCloseElapsed   = 0f;
         openingSpeed       = 1f;
     }
 }
Пример #11
0
    public virtual void Clear()
    {
        SpritedString textLineComponent = null;
        GameObject    textLineObject    = null;

        if (textLineComponents != null)
        {
            for (int i = 0; i < textLineComponents.Length; i++)
            {
                textLineComponent = textLineComponents[i];
                if (textLineComponent != null)
                {
                    textLineComponent.Clear();
                    textLineComponents[i] = null;
                }
            }
            textLineComponents = null;
        }
        if (textLineObjects != null)
        {
            for (int i = 0; i < textLineObjects.Length; i++)
            {
                textLineObject = textLineObjects[i];
                if (textLineObject != null)
                {
                    Destroy(textLineObject);
                    textLineObjects[i] = null;
                }
            }
            textLineObjects = null;
        }
        if (textLines != null)
        {
            for (int i = 0; i < textLines.Length; i++)
            {
                textLines[i] = null;
            }
            textLines = null;
        }
        textLinesReady = false;
        text           = null;
        boxSprite      = null;
        boxRenderer    = null;
        if (boxObject != null)
        {
            Destroy(boxObject);
            boxObject = null;
        }
        symbolDatabase = null;
        built          = false;
        cleared        = true;
    }
Пример #12
0
 void Awake()
 {
     spriteSource     = null;
     symbolAmount     = 0;
     symbolObjects    = null;
     symbolRenderers  = null;
     symbolSMs        = null;
     symbolTransforms = null;
     symbolWidths     = null;
     value            = null;
     width            = 0f;
     height           = 0f;
     fontModMaterial  = null;
 }
Пример #13
0
    public void SetSymbolSource(SymbolDatabase newSpriteSource)
    {
        Material fontModifier = null;

        spriteSource = newSpriteSource;
        if (spriteSource != null)
        {
            fontModifier = spriteSource.fontModMaterial;
            if (fontModifier != null)
            {
                fontModMaterial = new Material(fontModifier);
            }
        }
    }
Пример #14
0
 public void SetEssentials(SymbolDatabase newSymbolDatabase, Sprite newBoxSprite, string newText, float newTextSpeed,
                           TextAlignment newTextAlignment, bool newAutoClose, float boxOpeningSpeed)
 {
     if (!built && !cleared)
     {
         symbolDatabase = newSymbolDatabase;
         boxSprite      = newBoxSprite;
         text           = newText;
         textSpeed      = (newTextSpeed >= 0f) ? newTextSpeed : textSpeed;
         symbolDuration = (textSpeed > 0f) ? (1f / textSpeed) : (1f / DEFAULT_TEXT_SPEED);
         textAlignment  = newTextAlignment;
         autoClose      = newAutoClose;
         openingSpeed   = boxOpeningSpeed;
     }
 }
Пример #15
0
 void Awake()
 {
     spriteSource    = null;
     digitAmount     = 0;
     digitObjects    = null;
     digitImages     = null;
     digitTransforms = null;
     ownTransform    = this.gameObject.GetComponent <RectTransform>();
     innerValue      = 0;
     outerValue      = 0;
     suddenChange    = false;
     framesPerValue  = 1;
     elapsedFrames   = 0;
     initialized     = false;
     raycastTarget   = true;
 }
Пример #16
0
 public void SetMaterials(SymbolDatabase newSymbolDatabase, BoxAppearanceDatabase newBoxDatabase)
 {
     symbolDatabase = newSymbolDatabase;
     boxDatabase    = newBoxDatabase;
     if (boxDatabase != null)
     {
         if (!boxDatabase.GetBoxAppearance(BoxAppearanceDatabase.BoxPurpose.Transaction, 0, ref bodySprite, ref tailSprite))
         {
             boxAppearanceIndex = -1;
             bodySprite         = null;
             tailSprite         = null;
         }
         else
         {
             boxAppearanceIndex = 0;
             ExtractTailDimensions();
         }
     }
 }
Пример #17
0
    public void SetMaterials(SymbolDatabase newSymbolDatabase, BoxAppearanceDatabase newBoxDatabase)
    {
        Sprite tailSprite = null;

        symbolDatabase = newSymbolDatabase;
        boxDatabase    = newBoxDatabase;
        if (boxDatabase != null)
        {
            if (!boxDatabase.GetBoxAppearance(BoxAppearanceDatabase.BoxPurpose.UI, 0, ref bodySprite, ref tailSprite))
            {
                boxAppearanceIndex = -1;
                bodySprite         = null;
            }
            else
            {
                boxAppearanceIndex = 0;
            }
        }
    }
Пример #18
0
 void Awake()
 {
     spriteSource         = null;
     symbolAmount         = 0;
     symbolObjects        = null;
     symbolImages         = null;
     symbolTransforms     = null;
     symbolWidths         = null;
     fontModMaterial      = null;
     ownTransform         = gameObject.GetComponent <RectTransform>();
     value                = null;
     width                = 0f;
     height               = 0f;
     raycastTarget        = true;
     currentGeneralColor  = Color.white;
     currentColor         = Color.white;
     currentColorGradient = Vector4.zero;
     colorID              = Shader.PropertyToID("_NewColor");
     colorGradientID      = Shader.PropertyToID("_Gradient");
     vertexToCameraID     = Shader.PropertyToID("_VertexToCamera");
 }
Пример #19
0
 public void SetEssentials(SymbolDatabase newSymbolDatabase, Sprite newBoxSprite, string newText, float newTextSpeed,
                           TextAlignment newTextAlignment, Sprite newPicture, bool newAutoClose, float boxOriginAlpha, float boxTargetAlpha,
                           Vector2 boxOriginScale, Vector2 boxTargetScale, float boxOpeningSpeed)
 {
     if (!built && !cleared)
     {
         symbolDatabase = newSymbolDatabase;
         boxSprite      = newBoxSprite;
         text           = newText;
         textSpeed      = (newTextSpeed >= 0f) ? newTextSpeed : textSpeed;
         symbolDuration = (textSpeed > 0f) ? (1f / textSpeed) : 0f;
         textAlignment  = newTextAlignment;
         picture        = newPicture;
         autoClose      = newAutoClose;
         closedAlpha    = boxOriginAlpha;
         openAlpha      = boxTargetAlpha;
         closedScale    = boxOriginScale;
         openScale      = boxTargetScale;
         openingSpeed   = boxOpeningSpeed;
     }
 }
Пример #20
0
 private TextBoxUIManager()
 {
     boxObjects             = null;
     boxComponents          = null;
     boxMasterEvents        = null;
     boxMasterItems         = null;
     boxQuestionRoles       = null;
     boxOptionIndexes       = null;
     symbolDatabase         = null;
     boxDatabase            = null;
     boxAppearanceIndex     = -1;
     bodySprite             = null;
     uiCanvasTrans          = null;
     questionDelegate       = null;
     enunciateBoxComponent  = null;
     optionAwaitedIndex     = -1;
     optionChosenIndex      = -1;
     optionIndexConfirm     = -1;
     optionIndexCancel      = -1;
     optionComponentConfirm = null;
     optionComponentCancel  = null;
     itemOnDisplay          = false;
 }
Пример #21
0
 public bool AddInterfaceCanvasText(string textString, SymbolDatabase textFont, Color textColor, Vector4 textColorGradient, int textEvolution,
                                    Transform originTransform, Vector2 originTransformOffset, bool workDuringPause)
 {
     return(AddCanvasText(textString, textFont, textColor, textColorGradient, textEvolution, originTransform, originTransformOffset,
                          workDuringPause));
 }
Пример #22
0
    public virtual void Clear()
    {
        SpritedStringUI textLineComponent = null;
        GameObject      textLineObject    = null;

        if (textLineComponents != null)
        {
            for (int i = 0; i < textLineComponents.Length; i++)
            {
                textLineComponent = textLineComponents[i];
                if (textLineComponent != null)
                {
                    textLineComponent.Clear();
                    textLineComponents[i] = null;
                }
            }
            textLineComponents = null;
        }
        if (textLineTransforms != null)
        {
            for (int i = 0; i < textLineTransforms.Length; i++)
            {
                textLineTransforms[i] = null;
            }
            textLineTransforms = null;
        }
        if (textLineObjects != null)
        {
            for (int i = 0; i < textLineObjects.Length; i++)
            {
                textLineObject = textLineObjects[i];
                if (textLineObject != null)
                {
                    Destroy(textLineObject);
                    textLineObjects[i] = null;
                }
            }
            textLineObjects = null;
        }
        if (textLines != null)
        {
            for (int i = 0; i < textLines.Length; i++)
            {
                textLines[i] = null;
            }
            textLines = null;
        }
        text = null;
        if (pictureObject != null)
        {
            pictureImage = null;
            pictureTrans = null;
            Destroy(pictureObject);
            pictureObject = null;
        }
        picture      = null;
        boxSprite    = null;
        boxImage     = null;
        boxTransform = null;
        if (boxObject != null)
        {
            Destroy(boxObject);
            boxObject = null;
        }
        symbolDatabase = null;
        built          = false;
        cleared        = true;
    }
Пример #23
0
    protected virtual void Awake()
    {
        rbody              = GetComponent <Rigidbody2D>();
        pressingUpMove     = false;
        pressingUpAim      = false;
        pressingLeftMove   = false;
        pressingLeftAim    = false;
        pressingDownMove   = false;
        pressingDownAim    = false;
        pressingRightMove  = false;
        pressingRightAim   = false;
        standardDirections = null;
        CreateStandardDirections();
        directionMove             = Vector2.zero;
        directionAim              = Vector2.zero;
        directionPushed           = Vector2.zero;
        baseAccel                 = 0f;
        baseMaxSpeed              = 0f;
        baseMaxHP                 = 0f;
        baseAttack                = 0f;
        baseMaxFrequency          = 0f;
        finalAccel                = 0f;
        finalMaxSpeed             = 0f;
        finalMaxSpeedTemp         = 0f;
        finalMaxSpeedForced       = 0f;
        finalMaxSqrSpeed          = 0f;
        finalMaxSqrSpeedTemp      = 0f;
        finalMaxSqrSpeedForced    = 0f;
        finalMaxSpeedLerpSpeed    = 0f;
        finalMaxSpeedLerpTraveled = 0f;
        finalMaxHP                = 0;
        finalAttack               = 0f;
        finalMaxFrequency         = 0f;
        currentHP                 = 0;
        projectileInterval        = 0f;
        projectileElapsed         = 0f;
        projectileSpeed           = originalProjectileSpeed;
        projectileAccel           = originalProjectileAccel;
        projectileMaxSpeed        = originalProjectileMaxSpeed;
        projectileDuration        = originalProjectileDuration;
        destructionLevel          = ObstacleController.CONSTRUCTION_LEVEL_INVALID;
        dead = true;
        over = false;
        SetBaseStatsToOriginals(true);

        stopRequested         = false;
        pushedIntensity       = 0f;
        adversaryObjects      = null;
        adversaryComponents   = null;
        projectileObjects     = null;
        projectileComponents  = null;
        projectileLaunchFront = null;
        projectileLaunchBack  = null;
        visualEffectObjects   = null;
        visualEffectAnimators = null;
        ValidateVisualEffectModels();
        mainCollider = mainCollider2D;
        radius       = 0f;
        width        = 0f;
        height       = 0f;
        if (mainCollider == null)
        {
            mainCollider = GetComponent <Collider2D>();
        }
        if (mainCollider != null)
        {
            width  = mainCollider.bounds.size.x;
            height = mainCollider.bounds.size.y;
            radius = (width > height) ? width / 2f : height / 2f;
        }
        paused         = false;
        pausedVelocity = Vector2.zero;
        shouldUnpause  = false;
        currentName    = null;
        SetCurrentName(agentName);
        acceptsDamage        = true;
        triggersTransactions = true;
        forcingFinalMaxSpeed = false;
        challengeStage       = null;
        cameraController     = null;
        fontDamage           = null;
        fontColorDamage      = new Color(1f, 0.8f, 0.2f, 1f);
        fontColorHeal        = new Color(0.7f, 1f, 0.2f, 1f);
        fontGradientDamage   = new Vector4(0f, 5f, 0f, 0f);

        audioSourceDamageIn = null;
        audioSourceVoice    = null;
        damageInSounds      = null;
        damageInSoundIDs    = null;
        deathSounds         = null;
        deathSoundIDs       = null;

        /*halmeida - the AudioCenter is a plugin for reducing latency of sounds in Android devices. It also supports the sound
         * playback outside of the Android environment, but that support is really poor, with a single AudioSource. Because
         * of that, I don't wanna use it unless we are within the android environment.*/
                #if !UNITY_ANDROID || UNITY_EDITOR
        AddAudioSources();
        LoadAllSoundsFromResources();
                #else
        LoadAllSoundsIntoAudioCenter();
                #endif
    }
Пример #24
0
 /*halmeida - carefull when using this method. If any memory is currently allocated, it will not be freed.*/
 protected virtual void ResetAllClassFields()
 {
     if (cleared)
     {
         canvasTransform    = null;
         symbolDatabase     = null;
         maxBoxWidth        = 0f;
         maxBoxHeight       = 0f;
         boxSizeLimitsSet   = false;
         maxTextWidth       = 0f;
         maxTextHeight      = 0f;
         boxSprite          = null;
         boxObject          = null;
         boxTransform       = null;
         boxImage           = null;
         boxArea            = new Rect(0f, 0f, 0f, 0f);
         textArea           = new Rect(0f, 0f, 0f, 0f);
         margin             = 0f;
         marginDouble       = 0f;
         lineHeight         = 0f;
         maxLineWidth       = 0f;
         maxLinesPerPage    = 0;
         pageFirstLineIndex = -1;
         pageLastLineIndex  = -1;
         built              = false;
         open               = false;
         openAlpha          = 1f;
         openScale          = Vector2.one;
         opening            = false;
         written            = false;
         closing            = false;
         closed             = false;
         closedAlpha        = 0f;
         closedScale        = new Vector2(0.1f, 0.1f);
         cleared            = false;
         instantCreation    = false;
         reactionType       = ReactionType.ReactAnywhere;
         textAlignment      = TextAlignment.AlignLeft;
         text               = null;
         textLines          = null;
         textLineObjects    = null;
         textLineTransforms = null;
         textLineComponents = null;
         textSpeed          = 0f;
         currentLine        = null;
         currentLineIndex   = -1;
         currentSymbolIndex = -1;
         currentLineLength  = 0;
         symbolDuration     = 0f;
         symbolElapsed      = 0f;
         writeImmediately   = false;
         autoClose          = false;
         autoCloseDuration  = 0f;
         autoCloseElapsed   = 0f;
         openingSpeed       = 1f;
         picture            = null;
         pictureObject      = null;
         pictureTrans       = null;
         pictureImage       = null;
     }
 }
Пример #25
0
    protected virtual void Awake()
    {
        GameObject     optionModel          = null;
        RectTransform  optionTrans          = null;
        ButtonAnimator optionComponent      = null;
        ChoiceEffect   optionChoiceEffect   = ChoiceEffect.None;
        GameObject     optionEventObject    = null;
        EventBase      optionEventComponent = null;
        int            optionEventID        = EventBase.INVALID_EVENT_ID;
        Vector2        optionScale          = Vector2.one;

        gameController                  = null;
        font                            = null;
        interfaceCanvasObject           = null;
        interfaceCanvasTrans            = null;
        interfaceCanvasComponent        = null;
        interfaceCanvasRect             = new Rect(0f, 0f, 0f, 0f);
        interfaceCanvasScreenRect       = new Rect(0f, 0f, 0f, 0f);
        imageOverlayModel               = null;
        imageOverlayObject              = null;
        imageOverlayComponent           = null;
        titleObject                     = null;
        titleTransform                  = null;
        titleComponent                  = null;
        titleTextObject                 = null;
        titleText                       = null;
        quitObject                      = null;
        quitTransform                   = null;
        quitComponent                   = null;
        quitTextObject                  = null;
        quitText                        = null;
        allowQuitOption                 = true;
        optionsParent                   = null;
        optionsParentTransform          = null;
        totalValidModels                = 0;
        totalValidOptionModels          = null;
        totalValidOptionScales          = null;
        totalValidOptionChoiceEffects   = null;
        totalValidOptionEventIDs        = null;
        currentValidModels              = 0;
        currentValidOptionModels        = null;
        currentValidOptionScales        = null;
        currentValidOptionChoiceEffects = null;
        currentValidOptionEventIDs      = null;
        optionObjects                   = null;
        optionTransforms                = null;
        optionComponents                = null;
        optionEffects                   = null;
        optionTextObjects               = null;
        optionTexts                     = null;
        selectedChoiceEffect            = ChoiceEffect.None;
        selectedQuitComponent           = null;
        selectedOptionComponent         = null;
        overlayFadeSpeed                = 0f;
        overlayFadeSpeedRef             = (backgroundAlphaSpeed > 0f) ? backgroundAlphaSpeed : 1f;
        overlayMaxAlpha                 = backgroundMaxAlpha;
        overlayDark                     = false;
        overlayClear                    = false;
        graphicsReady                   = false;
        graphicsCleared                 = false;
        touchingOverlay                 = false;
        draggingMenu                    = false;
        lastDragCanvasX                 = 0f;
        lastDragCanvasY                 = 0f;
        highestOptionTopY               = 0f;
        hiddenOptionHeight              = 0f;
        maxScreenOffsetLeft             = 0f;
        maxScreenOffsetRight            = 0f;
        maxScreenOffsetUp               = 0f;
        maxScreenOffsetDown             = 0f;
        requiringProgress               = false;
        clearBeforeEffect               = true;
        eventManager                    = null;
        previousMenu                    = null;
        if (optionModels != null)
        {
            for (int i = 0; i < optionModels.Length; i++)
            {
                optionModel = optionModels[i];
                if (optionModel != null)
                {
                    optionTrans     = optionModel.GetComponent <RectTransform>();
                    optionComponent = optionModel.GetComponent <ButtonAnimator>();
                    if ((optionTrans != null) && (optionComponent != null))
                    {
                        optionScale        = Vector2.one;
                        optionChoiceEffect = ChoiceEffect.None;
                        optionEventID      = EventBase.INVALID_EVENT_ID;
                        if (optionButtonScales != null)
                        {
                            if (optionButtonScales.Length > i)
                            {
                                optionScale = optionButtonScales[i];
                            }
                        }
                        if (optionChoiceEffects != null)
                        {
                            if (optionChoiceEffects.Length > i)
                            {
                                optionChoiceEffect = optionChoiceEffects[i];
                            }
                        }
                        if (optionEventRequirements != null)
                        {
                            if (optionEventRequirements.Length > i)
                            {
                                optionEventObject = optionEventRequirements[i];
                                if (optionEventObject != null)
                                {
                                    optionEventComponent = optionEventObject.GetComponent <EventBase>();
                                    if (optionEventComponent != null)
                                    {
                                        optionEventID = optionEventComponent.eventID;
                                    }
                                }
                            }
                        }
                        totalValidModels++;
                        UsefulFunctions.IncreaseArray <GameObject>(ref totalValidOptionModels, optionModel);
                        UsefulFunctions.IncreaseArray <Vector2>(ref totalValidOptionScales, optionScale);
                        UsefulFunctions.IncreaseArray <ChoiceEffect>(ref totalValidOptionChoiceEffects, optionChoiceEffect);
                        UsefulFunctions.IncreaseArray <int>(ref totalValidOptionEventIDs, optionEventID);
                    }
                }
            }
        }
    }
Пример #26
0
 public bool AddInterfaceCanvasText(string textString, SymbolDatabase textFont, Color textColor, Vector4 textColorGradient, int textEvolution,
                                    Vector2 originWorldPosition, bool workDuringPause)
 {
     return(AddCanvasText(textString, textFont, textColor, textColorGradient, textEvolution, null, originWorldPosition, workDuringPause));
 }
Пример #27
0
    private bool AddCanvasText(string textString, SymbolDatabase textFont, Color textColor, Vector4 textColorGradient, int textEvolution,
                               Transform originTransform, Vector2 originWorldPosition, bool workDuringPause)
    {
        GameObject      textObject         = null;
        RectTransform   textTrans          = null;
        SpritedStringUI text               = null;
        int             textIndex          = -1;
        Vector3         completeWorldPos   = Vector3.zero;
        Vector2         currentWorldPos    = Vector2.zero;
        Vector2         canvasPosition     = Vector2.zero;
        Vector2         textSpeed          = Vector2.zero;
        Vector2         textIncreasedScale = Vector2.zero;
        Color           textGeneralColor   = Color.white;
        float           textDurationShow   = 0f;
        float           textDurationPlain  = 0f;
        float           textDurationHide   = 0f;
        int             textStage          = INVALID_TEXT_STAGE;

        if (originTransform != null)
        {
            completeWorldPos = originTransform.position;
            currentWorldPos  = new Vector2(completeWorldPos.x, completeWorldPos.y);

            /*halmeida - in case there is an origin transform, the originWorldPosition vector is interpreted as an offset
             * from the transform's position.*/
            currentWorldPos += originWorldPosition;
        }
        else
        {
            currentWorldPos = originWorldPosition;
        }
        if (TransformWorldToCanvasPosition(currentWorldPos, ref canvasPosition))
        {
            textIndex  = (textObjects == null) ? 0 : textObjects.Length;
            textObject = new GameObject("UIText" + textIndex, typeof(RectTransform));
            if (textObject != null)
            {
                textTrans = textObject.GetComponent <RectTransform>();
                text      = textObject.AddComponent <SpritedStringUI>();
                if (text != null)
                {
                    text.SetSymbolSource(textFont);
                    text.ToggleRaycastTargeting(false);
                    text.SetValue(textString);
                    textTrans.SetParent(interfaceCanvasTrans, false);
                    textTrans.anchoredPosition = canvasPosition;
                    switch (textEvolution)
                    {
                    case TEXT_EVOLUTION_ASCENT:
                        textSpeed.y        = TEXT_ASCENT_SPEED;
                        textGeneralColor   = text.GetGeneralColor();
                        textGeneralColor.a = 0f;
                        text.SetGeneralColor(textGeneralColor);
                        textStage            = TEXT_STAGE_SHOW;
                        textIncreasedScale   = new Vector2(TEXT_ASCENT_START_SCALE_X, TEXT_ASCENT_START_SCALE_Y);
                        textTrans.localScale = new Vector3(textIncreasedScale.x, textIncreasedScale.y, 1f);
                        textDurationShow     = TEXT_ASCENT_DURATION_SHOW;
                        textDurationPlain    = TEXT_ASCENT_DURATION_PLAIN;
                        textDurationHide     = TEXT_ASCENT_DURATION_HIDE;
                        break;

                    case TEXT_EVOLUTION_STAY:
                        textGeneralColor   = text.GetGeneralColor();
                        textGeneralColor.a = 0f;
                        text.SetGeneralColor(textGeneralColor);
                        textStage            = TEXT_STAGE_SHOW;
                        textIncreasedScale   = new Vector2(TEXT_STAY_START_SCALE_X, TEXT_STAY_START_SCALE_Y);
                        textTrans.localScale = new Vector3(textIncreasedScale.x, textIncreasedScale.y, 1f);
                        textDurationShow     = TEXT_STAY_DURATION_SHOW;
                        textDurationPlain    = TEXT_STAY_DURATION_PLAIN;
                        textDurationHide     = TEXT_STAY_DURATION_HIDE;
                        break;

                    case TEXT_EVOLUTION_NONE_WAIT:
                    case TEXT_EVOLUTION_NONE_GO:
                        textGeneralColor   = text.GetGeneralColor();
                        textGeneralColor.a = 0f;
                        text.SetGeneralColor(textGeneralColor);
                        textStage            = TEXT_STAGE_SHOW;
                        textIncreasedScale   = new Vector2(TEXT_NONE_START_SCALE_X, TEXT_NONE_START_SCALE_Y);
                        textTrans.localScale = new Vector3(textIncreasedScale.x, textIncreasedScale.y, 1f);
                        textDurationShow     = TEXT_NONE_DURATION_SHOW;
                        textDurationPlain    = TEXT_NONE_DURATION_PLAIN;
                        textDurationHide     = TEXT_NONE_DURATION_HIDE;
                        break;
                    }
                    text.SetColor(textColor, textColorGradient);
                    UsefulFunctions.IncreaseArray <GameObject>(ref textObjects, textObject);
                    UsefulFunctions.IncreaseArray <RectTransform>(ref textTransforms, textTrans);
                    UsefulFunctions.IncreaseArray <SpritedStringUI>(ref texts, text);
                    UsefulFunctions.IncreaseArray <int>(ref textEvolutions, textEvolution);
                    UsefulFunctions.IncreaseArray <Transform>(ref textOriginTransforms, originTransform);
                    UsefulFunctions.IncreaseArray <Vector2>(ref textOriginPositions, originWorldPosition);
                    UsefulFunctions.IncreaseArray <Vector2>(ref textSpeeds, textSpeed);
                    UsefulFunctions.IncreaseArray <Vector2>(ref textIncreasedScales, textIncreasedScale);
                    UsefulFunctions.IncreaseArray <float>(ref textDurationsShow, textDurationShow);
                    UsefulFunctions.IncreaseArray <float>(ref textDurationsPlain, textDurationPlain);
                    UsefulFunctions.IncreaseArray <float>(ref textDurationsHide, textDurationHide);
                    UsefulFunctions.IncreaseArray <int>(ref textStages, textStage);
                    UsefulFunctions.IncreaseArray <float>(ref textStageElapseds, 0f);
                    UsefulFunctions.IncreaseArray <float>(ref textElapseds, 0f);
                    UsefulFunctions.IncreaseArray <bool>(ref textPauseds, workDuringPause);
                    return(true);
                }
            }
            textTrans = null;
            if (textObject != null)
            {
                Destroy(textObject);
            }
        }
        return(false);
    }
Пример #28
0
 public void SetSymbolSource(SymbolDatabase newSpriteSource)
 {
     spriteSource = newSpriteSource;
 }
Пример #29
0
 public void SetDamageDisplayFont(SymbolDatabase newFontDamage)
 {
     fontDamage = newFontDamage;
 }
Пример #30
0
 public void Awake()
 {
     _symbolDatabase = GetComponentInParent <SymbolDatabase>();
     _boardTiles     = new List <BoardTile>();
 }