예제 #1
0
    public IEnumerator ActivateRoutine(RogueUI ui, PCEvent pc, int level)
    {
        this.pc = pc;
        this.ui = ui;

        rightFace.hpBar.gameObject.SetActive(false);
        rightFace.mpBar.gameObject.SetActive(false);
        rightFace.cdBar.gameObject.SetActive(false);

        PopulateBookData();
        bookBox.Populate(bookData);
        bookBox.selection = 0;
        PopulateScrollBoxForSelectedBook();

        levelText.text = "Cleared floor " + level + " with " + pc.gold + " gold. " +
                         "Craft spellbooks and challenge next floor! Press [ESC] when done.";
        PopulateTools();

        textbox.textbox.GetComponent <CanvasGroup>().alpha = 1.0f;

        ui.rightDisplayEnabled = true;
        UpdateDescriptionForSelectedBook();
        yield return(CoUtils.RunTween(GetComponent <CanvasGroup>().DOFade(1.0f, 1.0f)));

        yield return(textbox.EnableRoutine(null, false));

        descriptionNameBox.transform.parent.GetComponent <CanvasGroup>().alpha = 1.0f;
        yield return(SelectBookRoutine());
    }
예제 #2
0
    public IEnumerator OnVisibleRoutine(PCEvent pc)
    {
        while (IsAnimating())
        {
            yield return(null);
        }
        BattleEvent ev = GetComponent <BattleEvent>();

        if (ev != null)
        {
            BattleUnit unit = ev.unit;
            var        ui   = FindObjectOfType <RogueUI>();
            yield return(ui.PrepareTalkRoutine(unit));

            ui.face2.Populate(unit);

            pc.GetComponent <CharaEvent>().FaceToward(unit.battler.GetComponent <MapEvent>());
            unit.battler.GetComponent <CharaEvent>().FaceToward(pc.GetComponent <MapEvent>());

            LuaScript script = new LuaScript(ui.GetComponent <LuaContext>(), luaVisible);
            ui.GetComponent <LuaContext>().SetGlobal("name", unit.ToString());
            ui.rightDisplayEnabled = true;
            yield return(script.RunRoutine());

            ui.rightDisplayEnabled = false;
        }
        else
        {
            yield return(luaObject.RunRoutine(PropertyVisible));
        }
    }
예제 #3
0
 // called when the avatar stumbles into us
 // facing us if impassable, on top of us if passable
 public IEnumerator InteractRoutine(PCEvent pc)
 {
     if (GetComponent <CharaEvent>() != null)
     {
         GetComponent <CharaEvent>().facing = DirectionTo(pc.GetComponent <MapEvent>());
     }
     yield return(luaObject.RunRoutine(PropertyInteract));
 }
예제 #4
0
 // called when the pc stumbles into us
 // before the step if impassable, after if passable
 public IEnumerator CollideRoutine(PCEvent pc)
 {
     while (pc.GetComponent <MapEvent>().IsAnimating())
     {
         yield return(null);
     }
     yield return(luaObject.RunRoutine(PropertyCollide));
 }
예제 #5
0
 public void Populate(PCEvent pc)
 {
     this.pc = pc;
     Clear();
     for (int i = 0; i < pc.activeBook.spells.Count; i += 1)
     {
         SkillContainer container = Instantiate(containerPrefab);
         container.transform.SetParent(transform, false);
         container.Populate(pc, i);
     }
 }
예제 #6
0
 public IEnumerator OpenRoutine(PCEvent pc)
 {
     while (pc.GetComponent <MapEvent>().IsAnimating())
     {
         yield return(null);
     }
     pc.GetComponent <BattleEvent>().unit.battle.Log(pc.unit + " found a chest...", true);
     pc.GetComponent <BattleEvent>().AnimateBump();
     yield return(CoUtils.RunSequence(new IEnumerator[] {
         pc.GetComponent <BattleEvent>().FinishAnims(),
         doll.PlayOnceRoutine(),
         OnOpenRoutine(pc),
     }));
 }
예제 #7
0
    // === OUR ROUTINES ============================================================================

    private IEnumerator WalkRoutine(DynValue path)
    {
        PCEvent pc = Global.Instance().Maps.pc;

        foreach (DynValue dynDir in path.Tuple)
        {
            EightDir dir;
            if (dynDir.String.Equals("forward"))
            {
                dir = pc.GetComponent <CharaEvent>().facing;
            }
            else
            {
                dir = EightDirExtensions.Parse(dynDir.String);
            }
            yield return(pc.GetComponent <MapEvent>().StepRoutine(
                             pc.GetComponent <MapEvent>().location,
                             pc.GetComponent <MapEvent>().location + dir.XY()));
        }
    }
예제 #8
0
    public IEnumerator OnOpenRoutine(PCEvent pc)
    {
        if (!pc.GetComponent <BattleEvent>().unit.IsDead())
        {
            string qty1 = (quantity > 1) ? "" : "a ";
            string qty2 = (quantity > 1) ? (" x" + quantity) : "";
            pc.GetComponent <BattleEvent>().unit.battle.Log("It contained " + qty1 + contents.ItemName() + qty2 + "!", false);
            pc.PickUpItem(contents, quantity);
        }
        pc.GetComponent <CharaEvent>().facing  = EightDir.S;
        pc.GetComponent <CharaEvent>().armMode = ArmMode.Overhead;
        SpriteRenderer sprite = pc.pickup;

        sprite.sprite = contents.sprite;
        yield return(CoUtils.Wait(0.8f));

        sprite.sprite = null;
        pc.GetComponent <CharaEvent>().armMode = ArmMode.Disabled;

        opened = true;
        yield return(null);
    }
예제 #9
0
    public void Populate(PCEvent pc, int ordinal)
    {
        this.pc     = pc;
        skill       = pc.activeBook.spells[ordinal];
        icon.sprite = skill.icon;
        icon.color  = skill.school.Tint();
        label.text  = "F" + (ordinal + 1);
        if (skill.costMP > 0)
        {
            costLabel.color = MPColor;
            costLabel.text  = skill.costMP + " MP";
        }
        else
        {
            costLabel.color = CDColor;
            costLabel.text  = skill.costCD + " CD";
        }


        usable = unit.CanUse(skill);
        GetComponent <CanvasGroup>().alpha = usable ? 1.0f : 0.5f;
    }
예제 #10
0
 public static string RegisterYoungAssistance(Guid EventId, Guid? YoungId, string ChurchId, string Name, string Surnames, string Email, string Facebook, string BirthDay, decimal Cooperation)
 {
     PCEvent = new PCEvent();
      PCEvent.RegisterAssistance(EventId, YoungId, ChurchId == "" ? null : new Guid(ChurchId).NullG(), Name, Surnames, Email, Facebook, BirthDay == "" ? null : BirthDay.NullDT(), Cooperation);
        return PCEvent.GetMessagesFormatJson();
 }
예제 #11
0
    public void RecalculateVisibilityMap()
    {
        Profiler.BeginSample("los");
        mesh = GetComponent <TacticsTerrainMesh>();

        if (seenMap == null)
        {
            seenMap = new bool[mesh.size.x, mesh.size.y];
            for (int y = 0; y < mesh.size.y; y += 1)
            {
                for (int x = 0; x < mesh.size.x; x += 1)
                {
                    seenMap[x, y] = false;
                }
            }
            if (Application.isPlaying)
            {
                pc = Global.Instance().Maps.pc;
            }
            if (pc == null)
            {
                pc = FindObjectOfType <PCEvent>();
            }
        }

        if (oldLosTexture != null)
        {
            Destroy(oldLosTexture);
        }
        oldLosTexture         = losTexture;
        oldHeroPos            = heroPos;
        losTexture            = new Texture2D(mesh.size.x, mesh.size.y, TextureFormat.ARGB32, false);
        losTexture.filterMode = FilterMode.Point;
        losTexture.wrapMode   = TextureWrapMode.Clamp;
        heroPos  = pc.GetComponent <MapEvent3D>().TileToWorldCoords(pc.GetComponent <MapEvent>().location);
        heroPos += new Vector3(0.5f, 1.5f, 0.5f);

        map = new Color[mesh.size.x * mesh.size.y];
        BattleEvent battler = pc.GetComponent <BattleEvent>();
        Vector2Int  v       = new Vector2Int();

        for (int y = 0; y < mesh.size.y; y += 1)
        {
            for (int x = 0; x < mesh.size.x; x += 1)
            {
                float r = 1.0f;
                float b = 1.0f;
                v.x = x;
                v.y = y;
                if (battler.CanSeeLocation(mesh, v))
                {
                    seenMap[x, y] = true;
                }
                else
                {
                    r = 0.0f;
                    b = seenMap[x, y] ? 1.0f : 0.0f;
                }
                map[y * mesh.size.x + x] = new Color(r, 0.0f, b);
            }
        }
        losTexture.SetPixels(0, 0, mesh.size.x, mesh.size.y, map);
        losTexture.Apply();

        foreach (PCVisibility vis in GetComponent <Map>().GetEvents <PCVisibility>())
        {
            Vector2Int location = vis.GetComponent <MapEvent>().location;
            vis.SetVisibleByPC(CachedIsVisible(location));
        }

        Profiler.EndSample();
    }