Example #1
0
    // Use this for initialization
    void Start()
    {
        GameObject.Find("Fog").GetComponent <Fog>().AddRenderer(gameObject, this);
        int matAmount = 0;

        for (int x = 0; x < renderers.Length; x++)
        {
            matAmount += renderers[x].materials.Length;
        }
        defaultMat = new Color[matAmount];
        int z = 0;

        for (int x = 0; x < renderers.Length; x++)
        {
            for (int y = 0; y < renderers[x].materials.Length; y++)
            {
                defaultMat[z] = renderers[x].materials[y].color;
                z++;
            }
        }
        if (hideCursorIcon)
        {
            cursorObj = gameObject.GetComponent <CursorObject>();
            if (cursorObj == null)
            {
                hideCursorIcon = false;
            }
        }
    }
Example #2
0
        public void Awake()
        {
            // The colors to be initialized with can be overridden by FactionColorChange
            _factionColorChange = gameObject.GetComponent <FactionColorChange>();
            if (_factionColorChange != null && _factionColorChange.enabled)
            {
                _factionColorChange.ChangeColors();
                defaultMat     = new Color[0];
                pastVisibleMat = new Color[0];
            }

            int matAmount = 0;

            for (int x = 0; x < renderers.Length; x++)
            {
                matAmount += renderers[x].materials.Length;
            }
            if (defaultMat.Length < matAmount)
            {
                defaultMat = new Color[matAmount];
                InitializeMaterialColors(defaultMat);
            }
            if (pastVisibleMat.Length < matAmount)
            {
                pastVisibleMat = new Color[matAmount];
                InitializeMaterialColors(pastVisibleMat);
            }
            if (hideCursorIcon)
            {
                cursorObj = gameObject.GetComponent <CursorObject>();
            }
        }
Example #3
0
    void CallPauseMenu(bool inputFlag)
    {
        if (inputFlag)
        {
            if (pauseMenuObject == null)
            {
                int w = Screen.width / 2 * -1;
                int h = Screen.height / 2 * -1;

                float ww = Screen.width / 1280.0f;
                float hw = Screen.height / 720.0f;

                pauseMenuObject = CreateGUITexture("PauseMenu");
                pauseMenuObject.transform.position = new Vector3(0.5f, 0.5f, 2.0f);

                GUITexture menuFrame = CreateGUITexture("Menu_Frame", "UI/battle/battle_menu_frame",
                                                        new Rect(w + 427 * ww, h + 240 * hw, 424 * ww, 160 * hw));
                menuFrame.transform.parent        = pauseMenuObject.transform;
                menuFrame.transform.localPosition = new Vector3(0.0f, 0.0f, 2.1f);

                CursorObject co = CreateCursor(pauseMenuObject.transform);
                co.Prepare(inputManager, this, new int[2][] { new int[3] {
                                                                  2, (int)(192 * ww), (int)(w + 434 * ww)
                                                              }, new int[3] {
                                                                  1, 0, (int)(h + 273 * hw)
                                                              } }, 2);

                string[][] iPath = new string[2][] {
                    new string[2] {
                        "UI/battle/bmenu_button_item_normal", "UI/battle/bmenu_button_item_select"
                    },
                    new string[2] {
                        "UI/battle/bmenu_button_escape_normal", "UI/battle/bmenu_button_escape_select"
                    },
                };

                bool[] enableFlag = new bool[2] {
                    battleManager.playerList[0].nowHp > 0,
                    !battleManager.eventBattleflag,
                };
                for (int i = 0; i < 2; i++)
                {
                    GUITexture b = CreateGUITexture("button00" + i, iPath[i][0],
                                                    new Rect(w + 452 * ww + 192 * ww * i, h + 291 * hw, 182 * ww, 86 * hw));
                    b.transform.parent        = pauseMenuObject.transform;
                    b.transform.localPosition = new Vector3(0.0f, 0.0f, 2.2f);

                    ButtonObject mo = b.gameObject.AddComponent <ButtonObject> ();
                    mo.PrepareButton(co, i, iPath[i], b);
                    if (!enableFlag[i])
                    {
                        b.color = new Color(0.5f, 0.5f, 0.5f, 0.2f);
                    }
                }

                battleManager.StopAnimation();
            }
        }
    }
Example #4
0
 private void Awake()
 {
     if (cursorObject == null)
     {
         cursorObject = FindObjectOfType <CursorObject>();
     }
     cam = Camera.main;
 }
Example #5
0
    protected CursorObject CreateCursor(Transform p)
    {
        GameObject o = Instantiate(Resources.Load("Prefabs/UIPrefabs/UI_Cursor", typeof(GameObject)) as GameObject) as GameObject;

        o.transform.parent        = p;
        o.transform.localPosition = new Vector3(0.0f, 0.0f, 3.0f);

        CursorObject co = o.GetComponent <CursorObject> ();

        return(co);
    }
    private void UpdateVertical(GameObject currentLine, int currentLineNum)
    {
        var currRectTrans = CursorObject.GetComponent <RectTransform>();
        var newRectTrans  = currentLine.GetComponent <RectTransform>();

        currRectTrans.offsetMax = newRectTrans.offsetMax;
        currRectTrans.offsetMin = newRectTrans.offsetMin;
        currRectTrans.anchorMax = newRectTrans.anchorMax;
        currRectTrans.anchorMin = newRectTrans.anchorMin;

        currentVerticalPosition = currentLineNum;
    }
Example #7
0
    public void PrepareButton(CursorObject co, int n, string[] path, GUITexture gt)
    {
        _cursor      = co;
        buttonNumber = n;

        textures = new Texture[2] {
            Resources.Load(path [0], typeof(Texture)) as Texture,
            Resources.Load(path [1], typeof(Texture)) as Texture,
        };

        button = gt;
    }
 // ランダム位置にカーソルを生成
 public void setCursors(float x_min, float x_max, float y_min, float y_max)
 {
     for (int i = 0; i < cursornum; i++)
     {
         float x = UnityEngine.Random.Range(x_min, x_max);
         float y = UnityEngine.Random.Range(y_min, y_max);
         // カーソル(丸)生成
         CursorObject cursor = Instantiate(_cursor, new Vector3(x, y, 0), Quaternion.identity);
         // カーソルの相対角度を決定
         cursor.rad       = cursorAngle(i, cursornum, minAngle);
         cursor.primaryId = i;
         cursor.id        = cursorIds[i];
         // カーソルのListに追加
         cursors.Add(cursor);
     }
 }
Example #9
0
    public void Prepare(StatusData s, InputManager im, BattleGUIManager ho)
    {
        home = ho;

        float w = GetComponent <GUITexture> ().pixelInset.x;
        float h = GetComponent <GUITexture> ().pixelInset.y;

        float ww = Screen.width / 1280.0f;
        float hw = Screen.height / 720.0f;

        GUITexture itemFrame = CreateGUITexture("Item_Frame", "UI/battle/bmenu_item_frame", new Rect(w + 84 * ww, h + 15 * hw, 1072 * ww, 536 * hw));

        itemFrame.transform.parent        = transform;
        itemFrame.transform.localPosition = new Vector3(0.0f, 0.0f, 2.1f);
        status = s;

        int[][] lp = new int[2][] {
            new int[3] {
                2, (int)(505 * ww), (int)(w + 134 * ww)
            },
            new int[3] {
                status.itemList.Count / 2 + 1, (int)(-37 * hw), (int)(h + 450 * hw)
            }
        };
        CreateItemList(status.itemList, transform, lp, home.KozMinPro_Bold);

        int[][] sp = new int[2][] {
            new int[3] {
                2, (int)(505 * ww), (int)(w + 89 * ww)
            },
            new int[3] {
                status.itemList.Count / 2 + 1, (int)(-37 * hw), (int)(h + 397 * hw)
            }
        };

        cursor = CreateCursor(transform);
        cursor.Prepare(im, this, sp, status.itemList.Count);

        highLight = CreateHighLight(transform, new Vector2(cursor.cursorTexture.pixelInset.x + 45, cursor.cursorTexture.pixelInset.y + 26));

        CreateItemPreview(w + 119 * ww, h + 63 * hw);
    }
 // Use this for initialization
 void Start()
 {
     GameObject.Find("Fog").GetComponent<Fog>().AddRenderer(gameObject, this);
     int matAmount = 0;
     for(int x = 0; x < renderers.Length; x++){
         matAmount += renderers[x].materials.Length;
     }
     defaultMat = new Color[matAmount];
     int z = 0;
     for(int x = 0; x < renderers.Length; x++){
         for(int y = 0; y < renderers[x].materials.Length; y++){
             defaultMat[z] = renderers[x].materials[y].color;
             z++;
         }
     }
     if(hideCursorIcon){
         cursorObj = gameObject.GetComponent<CursorObject>();
         if(cursorObj == null)
             hideCursorIcon = false;
     }
 }
Example #11
0
    void CreateMainMenu(Transform t)
    {
        float wm = Screen.width / 1280.0f;
        float wh = Screen.height / 720.0f;

        GUITexture gt = CreateGUITexture("frame_under", fieldPath + "main_menu", new Rect(102 * wm, 68 * wh, 1078.0f * wm, 580.0f * wh));

        gt.transform.parent        = t;
        gt.transform.localPosition = new Vector3(0.0f, 0.0f, 2.1f);

        for (int i = 0; i < 4; i++)
        {
            int mem = status.partyMember[i];
            if (mem > -1)
            {
                gt = CreateGUITexture("chara_img", status.playersData[mem].charaImage[0], new Rect(385 * wm + 200 * wm * i, 75 * wh, 188.0f * wm, 572.0f * wh));
                gt.transform.parent        = t;
                gt.transform.localPosition = new Vector3(0.0f, 0.0f, 2.2f);
            }
        }

        highLight = CreateGUITexture("high_light", fieldPath + "main_button_select", new Rect(105 * wm, 567 * wh, 266.0f * wm, 80.0f * wh));
        highLight.transform.parent        = t;
        highLight.transform.localPosition = new Vector3(0.0f, 0.0f, 2.2f);

        gt = CreateGUITexture("frame_front", fieldPath + "main_menu_front", new Rect(102 * wm, 68 * wh, 1078.0f * wm, 580.0f * wh));
        gt.transform.parent        = t;
        gt.transform.localPosition = new Vector3(0.0f, 0.0f, 2.3f);

        for (int i = 0; i < 4; i++)
        {
            int mem = status.partyMember[i];
            if (mem > -1)
            {
                gt = CreateGUITexture("chara_name", status.playersData[mem].nameFolder, new Rect(400 * wm + 200.0f * wm * i, 620 * wh, 420.0f * wm * 0.36f, 64.0f * wh * 0.36f));
                gt.transform.parent        = t;
                gt.transform.localPosition = new Vector3(0.0f, 0.0f, 2.4f);

                GUIText text = CreateGUIText("level", status.playersData[mem].status.level.ToString(), (int)(64.0f * wm),
                                             new Vector2(550 * wm + 200.0f * wm * i, 236 * wh), KozMinPro_Bold);
                text.transform.parent        = t;
                text.transform.localPosition = new Vector3(0.0f, 0.0f, 2.4f);
                text.anchor    = TextAnchor.UpperRight;
                text.fontStyle = FontStyle.Italic;
                text.color     = new Color(1.0f, 0.98f, 0.8f);

                CreateStatusGauge(t, new Vector2(565 * wm + 200 * wm * i, 155 * wh), KozMinPro_Medium,
                                  new Rect(567 * wm + 200.0f * wm * i, 134 * wh, -176.0f * wm, 5.0f * wh), -27 * wh, status.playersData[mem].status,
                                  (int)(14.0f * wm), 2.4f, -176.0f * wm);
            }
        }

        CreateGUIText("money", status.Money.ToString(), (int)(17.0f * wm), new Vector2(346 * wm, 172 * wh),
                      KozMinPro_Heavy, t, 2.4f, TextAnchor.UpperRight);

        CreateGUIText("time", Time.realtimeSinceStartup.ToString(), (int)(17.0f * wm), new Vector2(346 * wm, 140 * wh),
                      KozMinPro_Heavy, t, 2.4f, TextAnchor.UpperRight);

        CreateGUIText("stage", status.stageData[sceneManager.nowStage].name, (int)(17.0f * wm), new Vector2(346 * wm, 108 * wh),
                      KozMinPro_Heavy, t, 2.4f, TextAnchor.UpperRight);

        int[][] st = new int[2][] {
            new int[3] {
                1, 0, (int)(105 * wm)
            },
            new int[3] {
                5, (int)(-92 * wh), (int)(567 * wh)
            },
        };
        cursor = CreateCursor(t);
        cursor.Prepare(inputManager, this, st, 5);

        nowSelect = CreateGUITexture("nowSelect", nowSelectImage[0], new Rect(200 * wm, 672 * wh, 546 * wm, 42 * wh));
        nowSelect.transform.parent        = t;
        nowSelect.transform.localPosition = new Vector3(0.0f, 0.0f, 2.2f);

        CreateGUITexture("Indication", fieldPath + "ui_Indication_1", new Rect(415 * wm, 3 * wh, 450 * wm, 52 * wh), t, 2.2f);
    }