Beispiel #1
0
    public void InitializePawn(PawnType type, string name, int initlevel,
                               int initattack, int initmagicAttack, int initdefense, int initmagicDefense, int inithp, int initdexterity, int initattackRange)
    {
        pawnType = type;
        Name     = name;
        level    = initlevel;

        attack       = currentAttack = initattack;
        defense      = currentDefense = initdefense;
        hp           = currentHP = inithp;
        dexterity    = currentDexterity = initdexterity;
        attackRange  = currentAttackRange = initattackRange;
        magicAttack  = currentMagicAttack = initmagicAttack;
        magicDefense = currentMagicDefense = initmagicDefense;

        skipCounter = 0;
        isSkip      = false;

        isIgnoreDefense = isIgnoreMagicDefense = false;
        animator        = this.transform.GetChild(0).GetComponent <Animator>();
        if (animator == null)
        {
            UnityEngine.Debug.Log("animator==null!");
        }

        uilog = FindObjectOfType <GameManager>().GetComponent <GameManager>().gameInteraction.uilog;

        InitPawn();
    }
Beispiel #2
0
        public override void SetParameters(ParameterCollection parameters)
        {
            // Assign to properties
            base.SetParameters(parameters);

            // Inject helper code into ChildContent
            if (ChildContent is RenderFragment originalChildContent)
            {
                ChildContent = builder =>
                {
                    var temp = Helpers.PARENT;
                    Helpers.PARENT = this;
                    originalChildContent(builder);
                    Helpers.PARENT = temp;
                };
            }

            if (!parameters.TryGetValue(nameof(Parent), out object _))
            {
                UILog.Write("WARNING", $"No parent assigned to '{this}'");
            }

            UpdateLayoutCss();
            UILog.Write("LIFECYCLE", $"SetParameters '{this}' (parent is '{Parent}')");
        }
Beispiel #3
0
        public async Task <IActionResult> Log([FromBody] UILog logRequest)
        {
            try
            {
                if (logRequest == null || string.IsNullOrEmpty(logRequest.Message))
                {
                    return(Ok(new OperationResponse
                    {
                        HasSucceeded = false,
                        Message = StatusMessages.DomainValidationError,
                        IsDomainValidationErrors = true
                    }));
                }

                await Task.Run(() =>
                {
                    LogInfo.Error(JsonConvert.SerializeObject(logRequest));
                });


                return(Ok());
            }
            catch (Exception ex)
            {
                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));

                return(Ok(new OperationResponse
                {
                    HasSucceeded = false,
                    Message = StatusMessages.ServerError,
                    IsDomainValidationErrors = false
                }));
            }
        }
Beispiel #4
0
 void Start()
 {
     txtMessage.text = string.Empty;
     uILog           = GetComponent <UILog>();
     gameController  = GetComponent <GameController>();
     panelNickname.SetActive(true);
     GetNickname();
 }
Beispiel #5
0
    private void Awake()
    {
        instance = this;
        RectTransform textRect = logText.GetComponent <RectTransform>();

        firstTextPos = new Vector2(textRect.anchoredPosition.x, textRect.anchoredPosition.y);
        thisRect     = transform.GetComponent <RectTransform>();
        yThreshold   = thisRect.rect.max.y;
    }
Beispiel #6
0
 public void Kill(int uid)
 {
     foreach (WaveComponent wc in waveComps)
     {
         if (wc.pool.despawn(uid))
         {
             return;
         }
     }
     UILog.AddText("Failed to kill" + uid);
 }
 public void launch()
 {
     if (exceedsCapacity)
     {
         UILog.AddText("Can't launch! Over Capacity!");
         return;
     }
     showUI(false);
     daysUntilSupply = supplyWait;
     UILog.AddText("Supply Shipped launched! Arriving in " + daysUntilSupply + " days.");
 }
Beispiel #8
0
 public void Kill(Critter obj)
 {
     foreach (WaveComponent wc in waveComps)
     {
         if (wc.pool.despawn(obj.gameObject))
         {
             return;
         }
     }
     UILog.AddText("Failed to kill" + obj.name + obj.entity.UID);
 }
Beispiel #9
0
 public void updateResources()
 {
     foreach (StructureController struc in allStrucs)
     {
         if (struc.product.type == Resource.Type.Power)
         {
             Resource.addCapacity(struc.product.type, struc.product.capacity);
         }
         else
         {
             Resource.addResource(struc.product.type, struc.product.amount);
         }
         UILog.AddText("Supplying " + struc.name);
     }
 }
    public void InitEnemyManager()
    {
        EnemyPawns = new List <Enemy>();
        gm         = GameObject.FindObjectOfType <GameManager>().GetComponent <GameManager>();
        EnemyRoot  = new GameObject("EnemyRoot");
        EnemyRoot.transform.SetParent(transform);
        EnemyRoot.transform.position = Vector3.zero;

        reader = new EnemyLootReader();
        uilog  = gm.gameInteraction.uilog;

        prefabs = new Dictionary <EnemyType, Enemy>
        {
            { EnemyType.wanderingswordman, EnemyPrefab_sword },
            { EnemyType.magicapprentice, EnemyPrefab_magic },
            { EnemyType.thief, EnemyPrefab_thief },
            { EnemyType.bandit, EnemyPrefab_bandit },
            { EnemyType.robinhood, EnemyPrefab_robinhood },

            { EnemyType.banditcaptain, EnemyPrefab_banditcaptain },
            { EnemyType.berserker, EnemyPrefab_berserker },
            { EnemyType.bard, EnemyPrefab_bard },
            { EnemyType.magicmaster, EnemyPrefab_magicmaster },
            { EnemyType.tatenoyousya, EnemyPrefab_tatenoyousta },

            { EnemyType.magicgrandmaster, EnemyPrefab_magicmgraneaster },
            { EnemyType.witch, EnemyPrefab_witch },
            { EnemyType.assassin, EnemyPrefab_assassin },
            { EnemyType.catapult, EnemyPrefab_catapult },
            { EnemyType.jinjyamiko, EnemyPrefab_jinjyamiko },

            { EnemyType.cultist, EnemyPrefab_cultist },
            { EnemyType.priest, EnemyPrefab_priest },
            { EnemyType.bloodwitch, EnemyPrefab_bloodwitch },
            { EnemyType.darkknight, EnemyPrefab_darkknight },
            { EnemyType.orchestraleader, EnemyPrefab_orchestraleader },

            { EnemyType.magebelial, EnemyPrefab_magebelial },
            { EnemyType.shadowfran, EnemyPrefab_shadowfran },
            { EnemyType.royalinquisitor, EnemyPrefab_royalinquisitor },
            { EnemyType.cardinaleriri, EnemyPrefab_cardinaleriri },
            { EnemyType.cinderlord, EnemyPrefab_cinderlord },

            { EnemyType.andrethehero, EnemyPrefab_andrethehero },
        };
    }
    public void placeStruc(Ray ray)
    {
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.collider.gameObject.GetComponent <Entity>() == null)
            {
                Instantiate(placing, hit.point, Quaternion.identity);
                if (placing.GetComponent <StructureController>())
                {
                    Resource.addResource(Resource.Type.Power, placing.gameObject.GetComponent <StructureController>().powerCost);
                    Resource.addResource(Resource.Type.BuildingMaterial, -placing.GetComponent <StructureController>().buildingMaterialCost);
                }
                isPlacing = false;
                UILog.AddText("Placing: " + placing.name);
                placing = null;
            }
        }
    }
Beispiel #12
0
 protected override void OnInit()
 {
     UILog.Write("LIFECYCLE", $"Initialize '{this}'");
 }
Beispiel #13
0
    public override IEnumerator Run()
    {
        if ("Dungeon" == SceneManager.GetActiveScene().name)
        {
            AsyncOperation operation = SceneManager.LoadSceneAsync("Common", LoadSceneMode.Additive);
            while (false == operation.isDone)
            {
                // loading progress
                yield return(null);
            }
            yield return(StartCoroutine(GameManager.Instance.Init()));
        }

        log = UIUtil.FindChild <UILog>(transform, "UI/UILog");
        log.gameObject.SetActive(true);

        dungeon = UIUtil.FindChild <Dungeon>(transform, "Dungeon");
        dungeon.gameObject.SetActive(true);
        dungeon_move = UIUtil.FindChild <DungeonMove>(transform, "Dungeon");

        battle = UIUtil.FindChild <DungeonBattle>(transform, "Battle");
        battle.gameObject.SetActive(false);

        ui_inventory = UIUtil.FindChild <UIInventory>(transform, "UI/UIInventory");
        ui_inventory.gameObject.SetActive(false);
        ui_inventory.Init();

        inventory_button = UIUtil.FindChild <Button>(transform, "UI/Dungeon/SideButtons/InventoryButton");
        inventory_button.onClick.AddListener(() =>
        {
            ui_inventory.gameObject.SetActive(true);
            Util.EventSystem.Publish(EventID.Dungeon_Monster_Reveal);
        });

        text_inventory = UIUtil.FindChild <Text>(transform, "UI/Dungeon/SideButtons/InventoryButton/Text");

        mini_map = UIUtil.FindChild <UIMiniMap>(transform, "UI/Dungeon/MiniMap");
        mini_map.gameObject.SetActive(true);

        ui_player_transform = UIUtil.FindChild <Transform>(transform, "UI/Player");
        ui_player_transform.gameObject.SetActive(true);
        player_health = UIUtil.FindChild <UIGaugeBar>(ui_player_transform, "Health");
        player_exp    = UIUtil.FindChild <UIGaugeBar>(ui_player_transform, "Exp");

        ui_coin = UIUtil.FindChild <UICoin>(transform, "UI/Dungeon/UICoin");
        ui_coin.gameObject.SetActive(true);
        {
            Image image = UIUtil.FindChild <Image>(ui_coin.transform, "Image");
            ui_coin_position = Camera.main.ScreenToWorldPoint(
                new Vector3(image.rectTransform.position.x, image.rectTransform.position.y, Camera.main.transform.position.z * -1.0f)
                );
        }


        coin_spot = UIUtil.FindChild <Transform>(transform, "CoinSpot");
        coin_spot.gameObject.SetActive(true);
        coin_prefab = UIUtil.FindChild <Coin>(transform, "Prefabs/Coin");

        shop = UIUtil.FindChild <UIShop>(transform, "UI/UIShop");

        Util.EventSystem.Subscribe <int>(EventID.Dungeon_Move, OnMove);
        Util.EventSystem.Subscribe(EventID.Dungeon_Exit_Unlock, () => { StartCoroutine(OnExitUnlock()); });
        Util.EventSystem.Subscribe(EventID.Dungeon_Map_Reveal, () => { mini_map.RevealMap(); });
        Util.EventSystem.Subscribe(EventID.Dungeon_Monster_Reveal, () => { mini_map.RevealMonster(); });
        Util.EventSystem.Subscribe(EventID.Dungeon_Treasure_Reveal, () => { mini_map.RevealTreasure(); });
        Util.EventSystem.Subscribe <Item>(EventID.Inventory_Add, OnItemAdd);
        Util.EventSystem.Subscribe <Item>(EventID.Inventory_Remove, OnItemRemove);
        Util.EventSystem.Subscribe(EventID.Player_Stat_Change, OnPlayerStatChange);
        Util.EventSystem.Subscribe <Quest>(EventID.Quest_Start, OnQuestStart);
        Util.EventSystem.Subscribe <Quest>(EventID.Quest_Complete, OnQuestComplete);
        AudioManager.Instance.Play(AudioManager.DUNGEON_BGM, true);

        InitScene();
    }
 public void OnDeath()
 {
     UILog.AddText("Unit: " + entity.UID.ToString() + " has died!");
     Destroy(waypoint.gameObject);
 }
Beispiel #15
0
 public virtual void Dispose()
 {
     UILog.Write("LIFECYCLE", $"Dispose '{this}'");
 }
Beispiel #16
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     base.BuildRenderTree(builder);
     UILog.Write("LIFECYCLE", $"BuildRenderTree '{this}'");
     _debugRenderCount = !_debugRenderCount;
 }
Beispiel #17
0
 void Start()
 {
     instance = this;
 }