コード例 #1
0
ファイル: UnitIcon.cs プロジェクト: zunaalabaya/TAC-BOT
        protected override void ShowTooltip(Vector2 screen)
        {
            if (!this.Tooltip)
            {
                return;
            }
            UnitData instanceData = this.GetInstanceData();

            if (instanceData == null)
            {
                return;
            }
            PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max);
            GameObject       gameObject  = (GameObject)Object.Instantiate <GameObject>((M0)AssetManager.Load <GameObject>("UI/UnitTooltip"));

            DataSource.Bind <UnitData>(gameObject, instanceData);
            DataSource.Bind <PlayerPartyTypes>(gameObject, dataOfClass);
            UnitJobDropdown componentInChildren = (UnitJobDropdown)gameObject.GetComponentInChildren <UnitJobDropdown>();

            if (!Object.op_Inequality((Object)componentInChildren, (Object)null))
            {
                return;
            }
            ((Component)componentInChildren).get_gameObject().SetActive((instanceData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max);
        }
コード例 #2
0
        private void RequestJobChange(bool immediate)
        {
            if (this.mRequestSent)
            {
                return;
            }
            PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max);

            this.mRequestSent = true;
            if ((this.mTargetUnit.TempFlags & UnitData.TemporaryFlags.TemporaryUnitData) != (UnitData.TemporaryFlags) 0)
            {
                MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(this.mTargetUnit.UniqueID).SetJobFor(dataOfClass, this.mTargetUnit.CurrentJob);
            }
            UnitJobDropdown.OnJobChange(this.mTargetUnit.UniqueID);
            ReqUnitJob reqUnitJob = (this.mTargetUnit.TempFlags & UnitData.TemporaryFlags.TemporaryUnitData) != (UnitData.TemporaryFlags) 0 ? new ReqUnitJob(this.mTargetUnit.UniqueID, this.mTargetUnit.CurrentJob.UniqueID, PartyData.GetStringFromPartyType(dataOfClass), new Network.ResponseCallback(this.JobChangeResult)) : new ReqUnitJob(this.mTargetUnit.UniqueID, this.mTargetUnit.CurrentJob.UniqueID, new Network.ResponseCallback(this.JobChangeResult));

            if (immediate)
            {
                int num = (int)Network.RequestAPIImmediate((WebAPI)reqUnitJob, true);
            }
            else
            {
                Network.RequestAPI((WebAPI)reqUnitJob, false);
            }
        }
コード例 #3
0
        private void OnEvent_ToolTip()
        {
            if (Object.op_Inequality((Object)this.m_ToolTip, (Object)null))
            {
                return;
            }
            SerializeValueList currentValue = FlowNode_ButtonEvent.currentValue as SerializeValueList;

            if (currentValue == null)
            {
                return;
            }
            UnitData dataSource = currentValue.GetDataSource <UnitData>("_self");

            if (dataSource == null || string.IsNullOrEmpty(this.ToolTipPrefab))
            {
                return;
            }
            GameObject root = (GameObject)Object.Instantiate <GameObject>((M0)AssetManager.Load <GameObject>(this.ToolTipPrefab));

            DataSource.Bind <UnitData>(root, dataSource);
            UnitJobDropdown componentInChildren1 = (UnitJobDropdown)root.GetComponentInChildren <UnitJobDropdown>();

            if (Object.op_Inequality((Object)componentInChildren1, (Object)null))
            {
                ((Component)componentInChildren1).get_gameObject().SetActive(true);
                Selectable component1 = (Selectable)((Component)componentInChildren1).get_gameObject().GetComponent <Selectable>();
                if (Object.op_Inequality((Object)component1, (Object)null))
                {
                    component1.set_interactable(false);
                }
                Image component2 = (Image)((Component)componentInChildren1).get_gameObject().GetComponent <Image>();
                if (Object.op_Inequality((Object)component2, (Object)null))
                {
                    ((Graphic)component2).set_color(new Color(0.5f, 0.5f, 0.5f));
                }
            }
            ArtifactSlots componentInChildren2 = (ArtifactSlots)root.GetComponentInChildren <ArtifactSlots>();
            AbilitySlots  componentInChildren3 = (AbilitySlots)root.GetComponentInChildren <AbilitySlots>();

            if (Object.op_Inequality((Object)componentInChildren2, (Object)null) && Object.op_Inequality((Object)componentInChildren3, (Object)null))
            {
                componentInChildren2.Refresh(false);
                componentInChildren3.Refresh(false);
            }
            ConceptCardSlots componentInChildren4 = (ConceptCardSlots)root.GetComponentInChildren <ConceptCardSlots>();

            if (Object.op_Inequality((Object)componentInChildren4, (Object)null))
            {
                componentInChildren4.Refresh(false);
            }
            GameParameter.UpdateAll(root);
            this.m_ToolTip = root;
        }
コード例 #4
0
        protected override void Start()
        {
            base.Start();
            UnitJobDropdown unitJobDropdown = this;

            // ISSUE: method pointer
            unitJobDropdown.OnSelectionChange = (UnityAction <int>)System.Delegate.Combine((System.Delegate)unitJobDropdown.OnSelectionChange, (System.Delegate) new UnityAction <int>((object)this, __methodptr(JobChanged)));
            if (!this.RefreshOnStart)
            {
                return;
            }
            this.Refresh();
        }
コード例 #5
0
ファイル: UnitIcon.cs プロジェクト: zunaalabaya/TAC-BOT
        protected override void ShowTooltip(Vector2 screen)
        {
            if (!this.Tooltip)
            {
                return;
            }
            this.UpdatePartyWindow();
            UnitData instanceData = this.GetInstanceData();

            if (instanceData == null)
            {
                return;
            }
            PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max);
            GameObject       root        = (GameObject)Object.Instantiate <GameObject>((M0)AssetManager.Load <GameObject>("UI/UnitTooltip_1"));
            UnitData         data        = new UnitData();

            data.Setup(instanceData);
            data.TempFlags = instanceData.TempFlags;
            DataSource.Bind <UnitData>(root, data);
            DataSource.Bind <PlayerPartyTypes>(root, dataOfClass);
            UnitJobDropdown componentInChildren1 = (UnitJobDropdown)root.GetComponentInChildren <UnitJobDropdown>();

            if (Object.op_Inequality((Object)componentInChildren1, (Object)null))
            {
                bool flag = (instanceData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max;
                ((Component)componentInChildren1).get_gameObject().SetActive(true);
                componentInChildren1.UpdateValue = new UnitJobDropdown.ParentObjectEvent(this.UpdateValue);
                Selectable component1 = (Selectable)((Component)componentInChildren1).get_gameObject().GetComponent <Selectable>();
                if (Object.op_Inequality((Object)component1, (Object)null))
                {
                    component1.set_interactable(flag);
                }
                Image component2 = (Image)((Component)componentInChildren1).get_gameObject().GetComponent <Image>();
                if (Object.op_Inequality((Object)component2, (Object)null))
                {
                    ((Graphic)component2).set_color(!flag ? new Color(0.5f, 0.5f, 0.5f) : Color.get_white());
                }
            }
            ArtifactSlots componentInChildren2 = (ArtifactSlots)root.GetComponentInChildren <ArtifactSlots>();
            AbilitySlots  componentInChildren3 = (AbilitySlots)root.GetComponentInChildren <AbilitySlots>();

            if (Object.op_Inequality((Object)componentInChildren2, (Object)null) && Object.op_Inequality((Object)componentInChildren3, (Object)null))
            {
                bool enable = (instanceData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max;
                componentInChildren2.Refresh(enable);
                componentInChildren3.Refresh(enable);
            }
            GameParameter.UpdateAll(root);
        }
コード例 #6
0
        private void BindData(GameObject go, UnitData unitData)
        {
            PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(go, PlayerPartyTypes.Max);

            DataSource.Bind <UnitData>(go, unitData);
            DataSource.Bind <PlayerPartyTypes>(go, dataOfClass);
            UnitJobDropdown componentInChildren1 = (UnitJobDropdown)go.GetComponentInChildren <UnitJobDropdown>();

            if (Object.op_Inequality((Object)componentInChildren1, (Object)null))
            {
                bool flag = (unitData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max;
                ((Component)componentInChildren1).get_gameObject().SetActive(true);
                componentInChildren1.UpdateValue = (UnitJobDropdown.ParentObjectEvent)null;
                Selectable component1 = (Selectable)((Component)componentInChildren1).get_gameObject().GetComponent <Selectable>();
                if (Object.op_Inequality((Object)component1, (Object)null))
                {
                    component1.set_interactable(flag);
                }
                Image component2 = (Image)((Component)componentInChildren1).get_gameObject().GetComponent <Image>();
                if (Object.op_Inequality((Object)component2, (Object)null))
                {
                    ((Graphic)component2).set_color(!flag ? new Color(0.5f, 0.5f, 0.5f) : Color.get_white());
                }
            }
            ArtifactSlots componentInChildren2 = (ArtifactSlots)go.GetComponentInChildren <ArtifactSlots>();
            AbilitySlots  componentInChildren3 = (AbilitySlots)go.GetComponentInChildren <AbilitySlots>();

            if (Object.op_Inequality((Object)componentInChildren2, (Object)null) && Object.op_Inequality((Object)componentInChildren3, (Object)null))
            {
                bool enable = (unitData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max;
                componentInChildren2.Refresh(enable);
                componentInChildren3.Refresh(enable);
            }
            ConceptCardSlots componentInChildren4 = (ConceptCardSlots)go.GetComponentInChildren <ConceptCardSlots>();

            if (!Object.op_Inequality((Object)componentInChildren4, (Object)null))
            {
                return;
            }
            bool enable1 = (unitData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max;

            componentInChildren4.Refresh(enable1);
        }